apache / lucene

Apache Lucene open-source search software
https://lucene.apache.org/
Apache License 2.0
2.64k stars 1.02k forks source link

Make remaining mutable Queries immutable [LUCENE-7078] #8134

Open asfimport opened 8 years ago

asfimport commented 8 years ago

See #7589 Mutable queries are an issue for automatic filter caching since modifying a query after it has been put into the cache will corrupt the cache. We should make all queries immutable (up to the boost) to avoid this issue.

Since they are part of the public API I would suggest splitting them in an immutable class and a builder like was done for most other Queries before releasing an official 6.x version

I did a quick scan through all derived classes of Query and I compiled the following list (ignoring sources in test or contrib folders) Some of them are already marked as experimental (but should perhaps receive the "official" @lucene.experimental tag ?) For some it's possibly not an issue since they should never end up in a filter cache (like MoreLikeThisQuery ?), but then a comment specifying the exception to the rule should perhaps be added.


Migrated from LUCENE-7078 by Luc Vanlerberghe (@LucVL), updated Jun 08 2017 Linked issues:

asfimport commented 8 years ago

Michael McCandless (@mikemccand) (migrated from JIRA)

Bulk move of still open issues from 6.2 to 6.3.