You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by GitBox <gi...@apache.org> on 2019/07/19 16:04:10 UTC

[GitHub] [lucene-solr] romseygeek commented on a change in pull request #797: LUCENE-8921: IndexSearcher.termStatistics requires docFreq totalTermFreq instead of TermStates

romseygeek commented on a change in pull request #797: LUCENE-8921: IndexSearcher.termStatistics requires docFreq totalTermFreq instead of TermStates
URL: https://github.com/apache/lucene-solr/pull/797#discussion_r305423851
 
 

 ##########
 File path: lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java
 ##########
 @@ -861,17 +861,17 @@ public String toString() {
   
   /**
    * Returns {@link TermStatistics} for a term, or {@code null} if
-   * the term does not exist.
+   * the term does not exist (if docFreq == 0).
    * 
    * This can be overridden for example, to return a term's statistics
    * across a distributed collection.
    * @lucene.experimental
    */
-  public TermStatistics termStatistics(Term term, TermStates context) throws IOException {
-    if (context.docFreq() == 0) {
+  public TermStatistics termStatistics(Term term, int docFreq, long totalTermFreq) throws IOException {
+    if (docFreq == 0) {
 
 Review comment:
   Given that the caller will always know whether or not `docFreq == 0`, maybe we should move this check up a level and make this throw an Exception if somebody passes in an empty docFreq?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org