Skip to content

Apache Lucene open-source search software

LUCENE-1113: fix for Document.getBoost() documentation

Daniel Naber0ae1e1a90500
diff --git a/src/java/org/apache/lucene/document/Document.java b/src/java/org/apache/lucene/document/Document.java
index b6deb4a9973..e95f218ef34 100644
--- a/src/java/org/apache/lucene/document/Document.java
+++ b/src/java/org/apache/lucene/document/Document.java
@@ -48,6 +48,8 @@ public final class Document implements java.io.Serializable {
/** Sets a boost factor for hits on any field of this document. This value
* will be multiplied into the score of all hits on this document.
*
+ * <p>The default value is 1.0.
+ *
* <p>Values are multiplied into the value of {@link Fieldable#getBoost()} of
* each field in this document. Thus, this method in effect sets a default
* boost for the fields of this document.
@@ -58,14 +60,15 @@ public final class Document implements java.io.Serializable {
this.boost = boost;
}
- /** Returns the boost factor for hits on any field of this document.
- *
- * <p>The default value is 1.0.
+ /** Returns, at indexing time, the boost factor as set by {@link #setBoost(float)}.
*
- * <p>Note: This value is not stored directly with the document in the index.
- * Documents returned from {@link IndexReader#document(int)} and
- * {@link Hits#doc(int)} may thus not have the same value present as when
- * this document was indexed.
+ * <p>Note that once a document is indexed this value is no longer available
+ * from the index. At search time, for retrieved documents, this method always
+ * returns 1. This however does not mean that the boost value set at indexing
+ * time was ignored - it was just combined with other indexing time factors and
+ * stored elsewhere, for better indexing and search performance. (For more
+ * information see the "norm(t,d)" part of the scoring formula in
+ * {@link org.apache.lucene.search.Similarity Similarity}.)
*
* @see #setBoost(float)
*/