[
https://issues.apache.org/jira/browse/LUCENE-6276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14962471#comment-14962471
]
David Smiley commented on LUCENE-6276:
--------------------------------------
This is neat. Couple things...
* RandomAccessWeight's 2-phase should probably call to a protected method on
RAW so that a subclass could define the cost based on how expensive using the
Bits is. Maybe it should be abstract and not zero?
* It will be difficult for many of the 2-phase implementations to calculate a
matchCost -- particularly the ones _not_ based on the number of term positions.
What to do? A constant of '0' (which you often labelled FIXME) is way too
cheap I think? Maybe the best we can hope for is simply a stable sort of
same-cost 2-phases and assuming that the order of queries added to a
BooleanQuery.Builder remains stable. This at least allows the user to tune
performance by changing the clause order for such constant matchCost queries.
But I see that the latest BooleanQuery.Builder is _not_ stable due to use of
HashSet / MultiSet versus LinkedHashSet which would be stable. What do you
think [~jpountz]? Alternatively (or in addition) a query wrapper could allow
explicitly setting a cost (vaguely similar to Solr's ExtendedQuery.getCost).
This could look similar to BoostQuery but for 2-phase matchCost instead of
score.
* Maybe the {{explain}} could possibly display the matchCost? It'd be nice to
troubleshoot/inspect for diagnostics somehow. Not critical, of course.
> 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
>
>
> 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]