[
https://issues.apache.org/jira/browse/LUCENE-6276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14956557#comment-14956557
]
Adrien Grand commented on LUCENE-6276:
--------------------------------------
TermStatistics is a class that we need to maintain backward compatibility for
since it's not experimental/internal. So we shouldn't put more methods in there
that we only need for implementation details of PhraseQuery/SpanNearQuery. I
would rather duplicate the logic. In addition, the current implementation of
this method is trappy as it assumes that the average term freq is 1 when
totalTermFreq is not available. While this might be ok for the matchCost
computation of phrase queries, it might not be for other use-cases.
The changes in ConjunctionDISI look good to me now, thanks.
{code}
+ if (w.twoPhaseView != null) {
+ matchCost += w.twoPhaseView.matchCost();
+ } else {
+ assert w.iterator instanceof TermScorer; // zero match cost.
+ }
{code}
{{w.twoPhaseView}} can be null on any scorer that does not expose an
approximation. So it can be not only a TermScorer, but also a
conjunction/disjunction of term scorers or even a custom query.
> Add matchCost() api to TwoPhaseDocIdSetIterator
> -----------------------------------------------
>
> Key: LUCENE-6276
> URL: https://issues.apache.org/jira/browse/LUCENE-6276
> Project: Lucene - Core
> Issue Type: Improvement
> Reporter: Robert Muir
> Attachments: LUCENE-6276-ExactPhraseOnly.patch,
> LUCENE-6276-NoSpans.patch, LUCENE-6276-NoSpans2.patch
>
>
> We could add a method like TwoPhaseDISI.matchCost() defined as something like
> estimate of nanoseconds or similar.
> ConjunctionScorer could use this method to sort its 'twoPhaseIterators' array
> so that cheaper ones are called first. Today it has no idea if one scorer is
> a simple phrase scorer on a short field vs another that might do some geo
> calculation or more expensive stuff.
> PhraseScorers could implement this based on index statistics (e.g.
> totalTermFreq/maxDoc)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]