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

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

Here is a patch. The main changes went to multi-term queries, DrillDownQuery 
and BoostingQuery:
 - Multi-term queries can't use BooleanQuery as a builder anymore since it's 
immutable so I had to change the API to allow to use something that is not a 
query as a builder.
 - DrillDownQuery was also using BooleanQuery as a buffer so I had to refactor 
it to use a List instead and only build the BooleanQuery when necessary.
 - BoostingQuery couldn't extend BooleanQuery anymore, so now it has its own 
Weight/Scorer implementation.

Here is what the TermCollectingRewrite API looks like now:
{code}
abstract class TermCollectingRewrite<B> extends MultiTermQuery.RewriteMethod {

  /** Return a suitable builder for the top-level Query for holding all 
expanded terms. */
  protected abstract B getTopLevelBuilder() throws IOException;

  /** Finalize the creation of the query from the builder. */
  protected abstract Query build(B builder);
}
{code}

> Make BooleanQuery immutable
> ---------------------------
>
>                 Key: LUCENE-6570
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6570
>             Project: Lucene - Core
>          Issue Type: Task
>            Reporter: Adrien Grand
>            Assignee: Adrien Grand
>            Priority: Minor
>         Attachments: LUCENE-6570.patch
>
>
> In the same spirit as LUCENE-6531 for the PhraseQuery, we should make 
> BooleanQuery immutable.
> The plan is the following:
>  - create BooleanQuery.Builder with the same setters as BooleanQuery today 
> (except setBoost) and a build() method that returns a BooleanQuery
>  - remove setters from BooleanQuery (except setBoost)
> I would also like to add some static utility methods for common use-cases of 
> this query, for instance:
>  - static BooleanQuery disjunction(Query... queries) to create a disjunction
>  - static BooleanQuery conjunction(Query... queries) to create a conjunction
>  - static BooleanQuery filtered(Query query, Query... filters) to create a 
> filtered query
> Hopefully this will help keep tests not too verbose, and the latter will also 
> help with the FilteredQuery derecation/removal.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to