use of org.apache.lucene.index.LogMergePolicy in project jackrabbit by apache.
the class AbstractIndex method getIndexWriter.
/**
* Returns an <code>IndexWriter</code> on this index.
* @return an <code>IndexWriter</code> on this index.
* @throws IOException if the writer cannot be obtained.
*/
protected synchronized IndexWriter getIndexWriter() throws IOException {
if (indexReader != null) {
indexReader.close();
log.debug("closing IndexReader.");
indexReader = null;
}
if (indexWriter == null) {
IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_36, analyzer);
config.setSimilarity(similarity);
LogMergePolicy mergePolicy = new LogByteSizeMergePolicy();
mergePolicy.setUseCompoundFile(useCompoundFile);
mergePolicy.setNoCFSRatio(1.0);
config.setMergePolicy(mergePolicy);
indexWriter = new IndexWriter(getDirectory(), config);
indexWriter.setInfoStream(STREAM_LOGGER);
}
return indexWriter;
}
use of org.apache.lucene.index.LogMergePolicy in project openolat by klemens.
the class JmsIndexer method newLogMergePolicy.
public LogMergePolicy newLogMergePolicy() {
LogMergePolicy logmp = new LogDocMergePolicy();
logmp.setCalibrateSizeByDeletes(true);
logmp.setMergeFactor(INDEX_MERGE_FACTOR);
return logmp;
}
Aggregations