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

Adrien Grand commented on LUCENE-6276:
--------------------------------------

Some suggestions:
 - could the match costs be computed eagerly instead of lazily, like we compute 
the costs of DocIdSetIterators?
 - can you move the utility methods to compute costs of phrases from 
TwoPhaseIterator into PhraseWeight/SpanNearQuery. I don't like leaking 
implementation details of specific TwoPhaseIterators into TwoPhaseIterator.
 - some implementations of matchCost return 0 (eg. RandomAccessWeight); I'm 
fine with not implementing every match cost for now, but could you leave a TODO 
and use a higher constant (eg. 100)? I think it's safer to assume that such 
implementations are costly until they are implemented correctly.
 - re: ReqExclScorer: indeed I think we should try to take into account the 
cost of advancing the excluded scorer. If this is complicated, I'm fine with 
tackling this problem later.
 - re: DisjunctionScorer: I think your current definition of the match cost is 
fine. Maybe we could improve it by weighting the match cost of each 
TwoPhaseIterator by the cost of their approximation. I think it would make 
sense since we will call TwoPhaseIterator.matches() more often if their 
approximation matches more documents.
 - AssertingSpans/AsseringScorer ensure that the match cost is >= 0. Maybe we 
should also check for NaN and document acceptable return values in the 
documentation of #matchCost?

> 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, LUCENE-6276.patch, 
> LUCENE-6276.patch, LUCENE-6276.patch, LUCENE-6276.patch, LUCENE-6276.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]

Reply via email to