[ 
https://issues.apache.org/jira/browse/LUCENE-5315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13808607#comment-13808607
 ] 

Kai Chan commented on LUCENE-5315:
----------------------------------

This is how I see it. I could be wrong though, and please feel free to point 
out if it is the case.

# The API reference of DocsEnum.freq() states that its return value is "term 
frequency in the current document, or 1 if the field was indexed with 
FieldInfo.IndexOptions.DOCS_ONLY". (I do not think the second part applies here 
though, just the first part.)
# Scorer and its subclasses extend DocEnum, and therefore their freq() methods 
override DocsEnum.freq().
# Because of (1) and (2), I thought the freq() method of Scorer and its 
subclasses should also return "term frequency in the current document", to 
honor the contract set by DocsEnum.freq().
# However, for some of Scorer's subclasses, (3) is not how the classes are 
currently implemented.

> Some subclasses of Scorer do not honor the contract of DocsEnum.freq()
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-5315
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5315
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/query/scoring
>    Affects Versions: 4.5.1
>            Reporter: Kai Chan
>         Attachments: DisjunctionMaxQueryTest.java, 
> DisjunctionMaxQueryTest.java.output
>
>
> The behavior of Scorer.freq() is inconsistent across its subclasses:
> * For TermScorer, the freq() method behaves just as DocsEnum.freq() 
> specifies, i.e. the method returns the "term frequency in the current 
> document".
> * For BooleanScorer2, ConjunctionScorer, DisjunctionMaxScorer, 
> DisjunctionSumScorer, and possibly other classes, the freq() method returns 
> the number of clauses (in BooleanQuery or DisjunctionMaxQuery) that match the 
> current document.
> This difference makes the meaning of Scorer.freq()'s return value uncertain. 
> To add to the uncertainty, given a Query, there seems to be no way of knowing 
> which behavior takes effect (as that is not specified in the API reference) 
> except by reading or running the code.
> This issue might be related to LUCENE-4514.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to