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

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

 - can you add to the javadocs of TwoPhaseIterator#matchCost that match costs 
need to be a positive number?
 - can you add some comments around the cost computation for 
disjunctions/conjunctions to explain the reasoning?
 - I would prefer termPositionsCost to be duplicated in PhraseWeight and 
SpanNearQuery than in TwoPhaseIterator, like we do for disjunctions 
(SpanOrQuery and DisjunctionScorer). I can understand the concerns around 
duplication but I think it's still cleaner than trying to share the logic by 
adding utility methods to TwoPhaseIterator.
 - I think SpanTermQuery.PHRASE_TO_SPAN_TERM_POSITIONS_COST should be static?

Otherwise the change looks good to me, I like the cost definition for 
conjunctions/disjunctions/phrases and we can tackle other queries in follow-up 
issues, but I think this is already a great start and will help execute slow 
queries more efficiently!

> 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, 
> 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: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to