use of org.neo4j.kernel.api.impl.index.partition.AbstractIndexPartition in project neo4j by neo4j.
the class LuceneLabelScanIndex method createSimpleReader.
private LabelScanReader createSimpleReader(List<AbstractIndexPartition> partitions) throws IOException {
AbstractIndexPartition partition = getFirstPartition(partitions);
PartitionSearcher searcher = partition.acquireSearcher();
return new SimpleLuceneLabelScanStoreReader(searcher, storageStrategy);
}
use of org.neo4j.kernel.api.impl.index.partition.AbstractIndexPartition in project neo4j by neo4j.
the class LuceneSchemaIndex method isOnline.
/**
* Check if this index is marked as online.
*
* @return <code>true</code> if index is online, <code>false</code> otherwise
* @throws IOException
*/
public boolean isOnline() throws IOException {
ensureOpen();
AbstractIndexPartition partition = getFirstPartition(getPartitions());
Directory directory = partition.getDirectory();
try (DirectoryReader reader = DirectoryReader.open(directory)) {
Map<String, String> userData = reader.getIndexCommit().getUserData();
return ONLINE.equals(userData.get(KEY_STATUS));
}
}
use of org.neo4j.kernel.api.impl.index.partition.AbstractIndexPartition in project neo4j by neo4j.
the class LuceneSchemaIndex method markAsOnline.
/**
* Marks index as online by including "status" -> "online" map into commit metadata of the first partition.
*
* @throws IOException
*/
public void markAsOnline() throws IOException {
ensureOpen();
AbstractIndexPartition partition = getFirstPartition(getPartitions());
IndexWriter indexWriter = partition.getIndexWriter();
indexWriter.setCommitData(ONLINE_COMMIT_USER_DATA);
flush(false);
}
use of org.neo4j.kernel.api.impl.index.partition.AbstractIndexPartition in project neo4j by neo4j.
the class LuceneSchemaIndex method createSimpleUniquenessVerifier.
private static UniquenessVerifier createSimpleUniquenessVerifier(List<AbstractIndexPartition> partitions) throws IOException {
AbstractIndexPartition singlePartition = getFirstPartition(partitions);
SearcherReference partitionSearcher = singlePartition.acquireSearcher();
return new SimpleUniquenessVerifier(partitionSearcher);
}
use of org.neo4j.kernel.api.impl.index.partition.AbstractIndexPartition in project neo4j by neo4j.
the class AbstractLuceneIndex method flush.
/**
* Commits all index partitions.
*
* @param merge also merge all segments together. This should be done before reading term frequencies.
* @throws IOException on Lucene I/O error.
*/
public void flush(boolean merge) throws IOException {
List<AbstractIndexPartition> partitions = getPartitions();
for (AbstractIndexPartition partition : partitions) {
IndexWriter writer = partition.getIndexWriter();
writer.commit();
if (merge) {
writer.forceMerge(1);
}
}
}
Aggregations