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

Explore different ways to apply boosts


    • Wish
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 5.4
    • None
    • None
    • New


      Follow-up from LUCENE-6570: the fact that all queries are mutable in order to allow for applying a boost raises issues since it makes queries bad cache keys since their hashcode can change anytime. We could just document that queries should never be modified after they have gone through IndexSearcher but it would be even better if the API made queries impossible to mutate at all.

      I think there are two main options:

      • either replace "void setBoost(boost)" with something like "Query withBoost(boost)" which would return a clone that has a different boost
      • or move boost handling outside of Query, for instance we could have a (immutable) query impl that would be dedicated to applying boosts, that queries that need to change boosts at rewrite time (such as BooleanQuery) would use as a wrapper.

      The latter idea is from Robert and I like it a lot given how often I either introduced or found a bug which was due to the boost parameter being ignored. Maybe there are other options, but I think this is worth exploring.


        1. LUCENE-6590.patch
          379 kB
          Adrien Grand
        2. LUCENE-6590.patch
          378 kB
          Adrien Grand
        3. LUCENE-6590.patch
          370 kB
          Adrien Grand
        4. LUCENE-6590.patch
          366 kB
          Adrien Grand
        5. LUCENE-6590.patch
          365 kB
          Adrien Grand
        6. LUCENE-6590.patch
          151 kB
          Adrien Grand
        7. LUCENE-6590.patch
          138 kB
          Adrien Grand

        Issue Links



              Unassigned Unassigned
              jpountz Adrien Grand
              1 Vote for this issue
              11 Start watching this issue