Move BooleanQuery static call into LuceneChangeModule
This is not really related to the LuceneChangeIndex, it's general Lucene setup that should happen once per process. Move it to LuceneIndexModule, which is a more general place. The actual location in that module is still somewhat arbitrary; arguably it could go in a LifecycleListener, but that seemed like overkill. Change-Id: I7354d4cae81a0a29568d2ee098e3e54cec49ff87
This commit is contained in:
@@ -72,7 +72,6 @@ import org.apache.lucene.document.TextField;
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
import org.apache.lucene.index.IndexableField;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.search.BooleanQuery;
|
||||
import org.apache.lucene.search.IndexSearcher;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.ScoreDoc;
|
||||
@@ -181,9 +180,6 @@ public class LuceneChangeIndex implements ChangeIndex {
|
||||
|
||||
queryBuilder = new QueryBuilder(openConfig.getAnalyzer());
|
||||
|
||||
BooleanQuery.setMaxClauseCount(cfg.getInt("index", "maxTerms",
|
||||
BooleanQuery.getMaxClauseCount()));
|
||||
|
||||
SearcherFactory searcherFactory = new SearcherFactory();
|
||||
if (cfg.getBoolean("index", "lucene", "testInmemory", false)) {
|
||||
openIndex = new SubIndex(new RAMDirectory(), "ramOpen", openConfig,
|
||||
|
@@ -27,6 +27,7 @@ import com.google.inject.Inject;
|
||||
import com.google.inject.Provides;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
import org.apache.lucene.search.BooleanQuery;
|
||||
import org.eclipse.jgit.lib.Config;
|
||||
|
||||
public class LuceneIndexModule extends LifecycleModule {
|
||||
@@ -57,6 +58,8 @@ public class LuceneIndexModule extends LifecycleModule {
|
||||
@Provides
|
||||
@Singleton
|
||||
IndexConfig getIndexConfig(@GerritServerConfig Config cfg) {
|
||||
BooleanQuery.setMaxClauseCount(cfg.getInt("index", "maxTerms",
|
||||
BooleanQuery.getMaxClauseCount()));
|
||||
return IndexConfig.fromConfig(cfg);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user