You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Adrien Grand (JIRA)" <ji...@apache.org> on 2015/05/20 11:00:00 UTC

[jira] [Updated] (LUCENE-6360) TermsQuery should rewrite to a ConstantScoreQuery over a BooleanQuery when there are few terms

     [ https://issues.apache.org/jira/browse/LUCENE-6360?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adrien Grand updated LUCENE-6360:
---------------------------------
    Attachment: LUCENE-6360.patch

Here is a patch.
 1. TermsQuery rewrites to a ConstantScoreQuery(BooleanQuery) when there are 16 terms or less.
 2. If there are more than 16 terms, then still per segment TermsQuery will first try to collect terms and if there are less than 16 terms that exist on this segment, it will also execute like a disjunction.

I took 16 as a threshold to use the same as MultiTermQueryConstantScoreWrapper.

1. is mostly useful for caching so that if you have a short TermsQuery it will share the same cache key as a disjunction around the same terms.

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