[
https://issues.apache.org/jira/browse/LUCENE-6360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14552321#comment-14552321
]
David Smiley commented on LUCENE-6360:
--------------------------------------
I reviewed the patch. The code for #2 is pretty interesting. I learn a lot by
reading your patches.
I noticed what looks like a bug in TermsQuery.createWeight.scorer:
{code:java}
// comparing references is fine here
if (field != lastField) {
terms = fields.terms(field);
if (terms == null) {
termsEnum = null;
} else {
termsEnum = terms.iterator();
}
}
{code}
Your code didn't introduce that, and yes I can read the comment :-) lastField
is never updated, so it will fetch terms.iterator() every time.
Secondly... I think the needsScores param should arguably not pass through to
the ConstantScoreQuery wrapped BooleanQuery, since this should be constant
scoring; no? Or maybe it's moot since it's CSQ after all.
Did you mean for the changes in CoalescedUpdates and FrozenBufferedUpdates to
be in this patch?
> TermsQuery should rewrite to a ConstantScoreQuery over a BooleanQuery when
> there are few terms
> ----------------------------------------------------------------------------------------------
>
> Key: LUCENE-6360
> URL: https://issues.apache.org/jira/browse/LUCENE-6360
> Project: Lucene - Core
> Issue Type: Improvement
> Reporter: Adrien Grand
> Assignee: Adrien Grand
> Priority: Minor
> Attachments: LUCENE-6360.patch
>
>
> TermsQuery helps when there are lot of terms from which you would like to
> compute the union, but it is a bit harmful when you have few terms since it
> cannot really skip: it always consumes all documents matching the underlying
> terms.
> It would certainly help to rewrite this query to a ConstantScoreQuery over a
> BooleanQuery when there are few terms in order to have actual skip support.
> As usual the hard part is probably to figure out the threshold. :)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]