Search in sources :

Example 1 with IndexReaderWarmer

use of org.apache.lucene.index.IndexWriter.IndexReaderWarmer in project lucene-solr by apache.

the class SolrIndexConfig method toIndexWriterConfig.

public IndexWriterConfig toIndexWriterConfig(SolrCore core) throws IOException {
    IndexSchema schema = core.getLatestSchema();
    IndexWriterConfig iwc = new IndexWriterConfig(new DelayedSchemaAnalyzer(core));
    if (maxBufferedDocs != -1)
        iwc.setMaxBufferedDocs(maxBufferedDocs);
    if (ramBufferSizeMB != -1)
        iwc.setRAMBufferSizeMB(ramBufferSizeMB);
    iwc.setSimilarity(schema.getSimilarity());
    MergePolicy mergePolicy = buildMergePolicy(schema);
    iwc.setMergePolicy(mergePolicy);
    MergeScheduler mergeScheduler = buildMergeScheduler(schema);
    iwc.setMergeScheduler(mergeScheduler);
    iwc.setInfoStream(infoStream);
    if (mergePolicy instanceof SortingMergePolicy) {
        Sort indexSort = ((SortingMergePolicy) mergePolicy).getSort();
        iwc.setIndexSort(indexSort);
    }
    iwc.setUseCompoundFile(useCompoundFile);
    if (mergedSegmentWarmerInfo != null) {
        // TODO: add infostream -> normal logging system (there is an issue somewhere)
        IndexReaderWarmer warmer = schema.getResourceLoader().newInstance(mergedSegmentWarmerInfo.className, IndexReaderWarmer.class, null, new Class[] { InfoStream.class }, new Object[] { iwc.getInfoStream() });
        iwc.setMergedSegmentWarmer(warmer);
    }
    return iwc;
}
Also used : SortingMergePolicy(org.apache.solr.index.SortingMergePolicy) MergePolicy(org.apache.lucene.index.MergePolicy) SortingMergePolicy(org.apache.solr.index.SortingMergePolicy) Sort(org.apache.lucene.search.Sort) IndexReaderWarmer(org.apache.lucene.index.IndexWriter.IndexReaderWarmer) IndexSchema(org.apache.solr.schema.IndexSchema) ConcurrentMergeScheduler(org.apache.lucene.index.ConcurrentMergeScheduler) MergeScheduler(org.apache.lucene.index.MergeScheduler) IndexWriterConfig(org.apache.lucene.index.IndexWriterConfig)

Aggregations

ConcurrentMergeScheduler (org.apache.lucene.index.ConcurrentMergeScheduler)1 IndexReaderWarmer (org.apache.lucene.index.IndexWriter.IndexReaderWarmer)1 IndexWriterConfig (org.apache.lucene.index.IndexWriterConfig)1 MergePolicy (org.apache.lucene.index.MergePolicy)1 MergeScheduler (org.apache.lucene.index.MergeScheduler)1 Sort (org.apache.lucene.search.Sort)1 SortingMergePolicy (org.apache.solr.index.SortingMergePolicy)1 IndexSchema (org.apache.solr.schema.IndexSchema)1