Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -599,20 +599,30 @@ public void close()

private int defaultMaxResults()
{
return XMath.cap_int(this.gigaMap.size());
return XMath.cap_int(this.gigaMap.size());
}

private void lazyInit() throws IOException
{
if(this.directory == null)
{
this.directory = this.createDirectory();
final IndexWriterConfig writerConfig = new IndexWriterConfig(
this.analyzer = this.context.analyzerCreator().createAnalyzer()
);
if(this.usesGraphDirectory())
{
// GraphDirectory stores index data in the persistent fileEntries map.
// ConcurrentMergeScheduler would modify that map from background threads,
// racing with GigaMap#store serialization. SerialMergeScheduler ensures
// merges run on the caller's thread, which holds the GigaMap lock.
writerConfig.setMergeScheduler(new SerialMergeScheduler());
Comment thread
fh-ms marked this conversation as resolved.
}
this.searcher = new IndexSearcher(
this.reader = DirectoryReader.open(
this.writer = new IndexWriter(
this.directory = this.createDirectory(),
new IndexWriterConfig(
this.analyzer = this.context.analyzerCreator().createAnalyzer()
)
this.directory,
writerConfig
)
)
);
Expand All @@ -630,12 +640,16 @@ private void lazyInit() throws IOException
}
}

private boolean usesGraphDirectory()
{
return this.context.directoryCreator() == null;
}

private Directory createDirectory()
{
final DirectoryCreator creator = this.context.directoryCreator();
return creator != null
? creator.createDirectory()
: new GraphDirectory()
return this.usesGraphDirectory()
? new GraphDirectory()
: this.context.directoryCreator().createDirectory()
;
}

Expand Down
Loading