Skip to content

Apache Lucene open-source search software

Add javadoc note in DoubleValuesSource (see LUCENE-10258) (#490)

Greg Miller4f5b41a71c41
diff --git a/lucene/core/src/java/org/apache/lucene/search/DoubleValuesSource.java b/lucene/core/src/java/org/apache/lucene/search/DoubleValuesSource.java
index d59bc9b37e3..5d4f7687dd0 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DoubleValuesSource.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DoubleValuesSource.java
@@ -326,7 +326,13 @@ public abstract class DoubleValuesSource implements SegmentCacheable {
}
}
- /** Returns a DoubleValues instance that wraps scores returned by a Scorer */
+ /**
+ * Returns a DoubleValues instance that wraps scores returned by a Scorer.
+ *
+ * <p>Note: If you intend to call {@link Scorable#score()} on the provided {@code scorer}
+ * separately, you may want to consider wrapping it with {@link
+ * ScoreCachingWrappingScorer#wrap(Scorable)} to avoid computing the actual score multiple times.
+ */
public static DoubleValues fromScorer(Scorable scorer) {
return new DoubleValues() {
@Override