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

ASF subversion and git services commented on LUCENE-8810:
---------------------------------------------------------

Commit a94093102edabed5a6722b45afcbc6789426194a in lucene-solr's branch 
refs/heads/branch_8x from Atri Sharma
[ https://gitbox.apache.org/repos/asf?p=lucene-solr.git;h=a940931 ]

LUCENE-8810: Honor MaxClausesCount in BooleanQuery (#787)

During Flattening, BooleanQuery will always try to flatten
nested clauses during rewrite. However, this can cause the
maximum number of clauses to be violated by the new query.
This commit disables flattening in the specific case.

> Flattening of nested disjunctions does not take into account number of clause 
> limitation of builder
> ---------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-8810
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8810
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/search
>    Affects Versions: 8.0
>            Reporter: Mickaël Sauvée
>            Priority: Minor
>             Fix For: 8.1.1
>
>         Attachments: LUCENE-8810.patch
>
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> In org.apache.lucene.search.BooleanQuery, at the end of the function 
> rewrite(IndexReader reader), the query is rewritten to flatten nested 
> disjunctions.
> This does not take into account the limitation on the number of clauses in a 
> builder (1024).
>  In some circumstances, this limite can be reached, hence an exception is 
> thrown.
> Here is a unit test that highlight this.
> {code:java}
>   public void testFlattenInnerDisjunctionsWithMoreThan1024Terms() throws 
> IOException {
>     IndexSearcher searcher = newSearcher(new MultiReader());
>     BooleanQuery.Builder builder1024 = new BooleanQuery.Builder();
>     for(int i = 0; i < 1024; i++) {
>       builder1024.add(new TermQuery(new Term("foo", "bar-" + i)), 
> Occur.SHOULD);
>     }
>     Query inner = builder1024.build();
>     Query query = new BooleanQuery.Builder()
>         .add(inner, Occur.SHOULD)
>         .add(new TermQuery(new Term("foo", "baz")), Occur.SHOULD)
>         .build();
>     searcher.rewrite(query);
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to