You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Terry Smith (JIRA)" <ji...@apache.org> on 2015/11/10 16:58:11 UTC

[jira] [Commented] (LUCENE-6889) BooleanQuery.rewrite could easily optimize some simple cases

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

Terry Smith commented on LUCENE-6889:
-------------------------------------

I like the last one but believe that the other two aren't correct.


bq. remove FILTER clauses when they are also a MUST clause

Seeing as a FILTER is a non scoring MUST this just doesn't sound right. The FILTER could constrain the result set more than just the MUST alone.

e.g. +foo #(+foo +bar)


bq. rewrite queries of the form +*:* #filter" to a ConstantScoreQuery(filter)

I don't think you can drop a +:*:* without affecting the score, but you could drop a #*:* if the BooleanQuery has something else to force inclusion (other MUST, FILTER or some SHOULD with an appropriate minNumShouldMatch).

For this case could Solr/ElasticSearch add the MatchAllDocs as a FILTER instead of a MUST to allow for this optimization?


We could detect duplicate FILTER and MUST_NOT clauses as described in LUCENE-6787.

Jira is turning star colon star (*:*) to a bold colon, so apologies if this doesn't read well through the web interface.





> BooleanQuery.rewrite could easily optimize some simple cases
> ------------------------------------------------------------
>
>                 Key: LUCENE-6889
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6889
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Adrien Grand
>            Priority: Minor
>
> Follow-up of SOLR-8251: APIs and user interfaces sometimes encourage to write BooleanQuery instances that are not optimal, for instance a typical case that happens often with Solr/Elasticsearch is to send a request that has a MatchAllDocsQuery as a query and some filter, which could be executed more efficiently by directly wrapping the filter into a ConstantScoreQuery.
> Here are some ideas of rewrite operations that BooleanQuery could perform:
>  - remove FILTER clauses when they are also a MUST clause
>  - rewrite queries of the form "+*:* #filter" to a ConstantScoreQuery(filter)
>  - rewrite to a MatchNoDocsQuery when a clause that is a MUST or FILTER clause is also a MUST_NOT clause



--
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