// Similarity from configuration:
Similarity similarity = pluginRegistry.getBeanByFullPrefix(SENSEI_INDEX_SIMILARITY, Similarity.class);
if (similarity == null) {
similarity = new DefaultSimilarity();
}
ZoieConfig zoieConfig;
if (_gateway != null) {
zoieConfig = new ZoieConfig(_gateway.getVersionComparator());
} else {
zoieConfig = new ZoieConfig();
}
zoieConfig.setAnalyzer(analyzer);
zoieConfig.setSimilarity(similarity);
zoieConfig.setBatchSize(_senseiConf.getInt(SENSEI_INDEX_BATCH_SIZE, ZoieConfig.DEFAULT_SETTING_BATCHSIZE));
zoieConfig.setBatchDelay(_senseiConf.getLong(SENSEI_INDEX_BATCH_DELAY, ZoieConfig.DEFAULT_SETTING_BATCHDELAY));
zoieConfig.setMaxBatchSize(_senseiConf.getInt(SENSEI_INDEX_BATCH_MAXSIZE, ZoieConfig.DEFAULT_MAX_BATCH_SIZE));
zoieConfig.setRamSizeInBytes(_senseiConf.getInt(SENSEI_INDEX_MAX_RAM_SEGMENT_SIZE, ZoieConfig.DEFAULT_RAM_SIZE_IN_BYTES));
zoieConfig.setMaxTotalWeight(_senseiConf.getInt(SENSEI_INDEX_MAX_TOTAL_WEIGHT, ZoieConfig.DEFAULT_MAX_TOTAL_WEIGHT));
zoieConfig.setRtIndexing(_senseiConf.getBoolean(SENSEI_INDEX_REALTIME, ZoieConfig.DEFAULT_SETTING_REALTIME));
zoieConfig.setSkipBadRecord(_senseiConf.getBoolean(SENSEI_SKIP_BAD_RECORDS, false));
int delay = _senseiConf.getInt(SENSEI_INDEX_FRESHNESS, 10);
ReaderCacheFactory readercachefactory;
if (delay > 0) {
readercachefactory = DefaultReaderCache.FACTORY;
zoieConfig.setFreshness(delay * 1000);
} else {
readercachefactory = SimpleReaderCache.FACTORY;
}
zoieConfig.setReadercachefactory(readercachefactory);
ShardingStrategy strategy = pluginRegistry.getBeanByFullPrefix(SENSEI_SHARDING_STRATEGY, ShardingStrategy.class);
if (strategy == null) {
strategy = new ShardingStrategy.FieldModShardingStrategy(_senseiSchema.getUidField());
}
Filter retentionFilter =
pluginRegistry.getBeanByFullPrefix(SENSEI_ZOIE_RETENTION_FILTER, Filter.class);
int deletionsBeforeOptimize = _senseiConf.getInt(SENSEI_ZOIE_RETENTION_DELETIONS_BEFORE_OPTIMIZE,
ZoieConfig.DEFAULT_NUM_DELETIONS_BEFORE_OPTIMIZE);
long purgePeriodMillis = _senseiConf.getLong(SENSEI_ZOIE_RETENTION_PURGE_PERIOD, ZoieConfig.DEFAULT_PURGE_PERIOD);
zoieConfig.setPurgeFilter(retentionFilter);
zoieConfig.setNumDeletionsBeforeOptimize(deletionsBeforeOptimize);
zoieConfig.setPurgePeriod(purgePeriodMillis);
pluggableSearchEngineManager = new PluggableSearchEngineManager();
pluggableSearchEngineManager.init(_senseiConf.getString(SENSEI_INDEX_DIR), nodeid, _senseiSchema, zoieConfig.getVersionComparator(), pluginRegistry, strategy);
List<FacetHandler<?>> facetHandlers = new LinkedList<FacetHandler<?>>();
List<RuntimeFacetHandlerFactory<?, ?>> runtimeFacetHandlerFactories = new LinkedList<RuntimeFacetHandlerFactory<?, ?>>();
int invertedIndexPenalty = _senseiConf.getInt(SENSEI_SEARCH_INVERTED_INDEX_PENALTY,