Search in sources :

Example 1 with FDBLuceneFileReference

use of com.apple.foundationdb.record.lucene.directory.FDBLuceneFileReference in project fdb-record-layer by FoundationDB.

the class LuceneIndexTest method assertEntriesAndSegmentInfoStoredInCompoundFile.

private static void assertEntriesAndSegmentInfoStoredInCompoundFile(@Nonnull Subspace subspace, @Nonnull FDBRecordContext context, @Nonnull String segment, boolean cleanFiles) {
    try (final FDBDirectory directory = new FDBDirectory(subspace, context)) {
        final FDBLuceneFileReference reference = directory.getFDBLuceneFileReference(segment).join();
        Assertions.assertNotNull(reference);
        Assertions.assertTrue(reference.getEntries().length > 0);
        Assertions.assertTrue(reference.getSegmentInfo().length > 0);
        assertOnlyCompoundFileExisting(subspace, context, directory, cleanFiles);
    }
}
Also used : FDBLuceneFileReference(com.apple.foundationdb.record.lucene.directory.FDBLuceneFileReference) FDBDirectory(com.apple.foundationdb.record.lucene.directory.FDBDirectory)

Example 2 with FDBLuceneFileReference

use of com.apple.foundationdb.record.lucene.directory.FDBLuceneFileReference in project fdb-record-layer by FoundationDB.

the class LuceneOptimizedWrappedIndexOutput method close.

@Override
public void close() throws IOException {
    FDBLuceneFileReference reference = new FDBLuceneFileReference(-1, -1, -1, -1);
    if (isSegmentInfo) {
        reference.setSegmentInfo(outputStream.toByteArray());
    } else {
        reference.setEntries(outputStream.toByteArray());
    }
    directory.writeFDBLuceneFileReference(name, reference);
}
Also used : FDBLuceneFileReference(com.apple.foundationdb.record.lucene.directory.FDBLuceneFileReference)

Aggregations

FDBLuceneFileReference (com.apple.foundationdb.record.lucene.directory.FDBLuceneFileReference)2 FDBDirectory (com.apple.foundationdb.record.lucene.directory.FDBDirectory)1