lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mickaël Sauvée (JIRA) <j...@apache.org>
Subject [jira] [Commented] (LUCENE-8810) Flattening of nested disjunctions does not take into account number of clause limitation of builder
Date Fri, 24 May 2019 07:24:00 GMT

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

Mickaël Sauvée commented on LUCENE-8810:
----------------------------------------

[~atris] In my test, the inner builder is not erroing (if I interpret well your comment):
this is the rewrite that raise an exception. The rewrite will flatten the 1025 clauses.

Maybe this is the expected behavior, but in 7.5 the rewrite was ok (without flattening of
course). So this is a change in behavior.

What I would have expected, is flattening to a max of 1024 clauses or do not flatten if not
possible, but not an exception raised. I may be wrong as I do not know what is "block-max
WAND" (line 479 of BooleanQuery).

> 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
>
>
> 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.3#76005)

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


Mime
View raw message