Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-6570

Make BooleanQuery immutable

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 5.3, 6.0
    • None
    • None
    • New

    Description

      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.

      Attachments

        1. LUCENE-6570.patch
          552 kB
          Adrien Grand

        Issue Links

          Activity

            People

              jpountz Adrien Grand
              jpountz Adrien Grand
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: