From 074da3789bfa39072707d8a3c6af54709824da20 Mon Sep 17 00:00:00 2001 From: Ragnar Mellbin Date: Tue, 22 Aug 2017 12:17:25 +0200 Subject: [PATCH] Rename from insight to bloom index --- .../BloomFieldEncoding.java} | 10 ++-- .../BloomIndex.java} | 26 +++++----- .../BloomIndexReader.java} | 4 +- .../BloomIndexTransactionEventUpdater.java} | 20 ++++---- .../BloomInsightDocumentStructure.java} | 8 ++-- .../BloomLuceneIndex.java} | 20 ++++---- .../PartitionedBloomIndexReader.java} | 21 ++++---- .../PartitionedInsightBloomWriter.java} | 10 ++-- .../SimpleBloomIndexReader.java} | 8 ++-- .../WritableDatabaseBloomIndex.java} | 18 +++---- .../BloomLuceneIndexUpdaterTest.java} | 48 +++++++++---------- 11 files changed, 95 insertions(+), 98 deletions(-) rename community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/{insight/InsightFieldEncoding.java => bloom/BloomFieldEncoding.java} (95%) rename community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/{insight/InsightIndex.java => bloom/BloomIndex.java} (71%) rename community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/{insight/InsightIndexReader.java => bloom/BloomIndexReader.java} (90%) rename community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/{insight/InsightIndexTransactionEventUpdater.java => bloom/BloomIndexTransactionEventUpdater.java} (84%) rename community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/{insight/LuceneInsightDocumentStructure.java => bloom/BloomInsightDocumentStructure.java} (94%) rename community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/{insight/InsightLuceneIndex.java => bloom/BloomLuceneIndex.java} (83%) rename community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/{insight/PartitionedInsightIndexReader.java => bloom/PartitionedBloomIndexReader.java} (74%) rename community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/{insight/PartitionedInsightIndexWriter.java => bloom/PartitionedInsightBloomWriter.java} (93%) rename community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/{insight/SimpleInsightIndexReader.java => bloom/SimpleBloomIndexReader.java} (93%) rename community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/{insight/WritableDatabaseInsightIndex.java => bloom/WritableDatabaseBloomIndex.java} (77%) rename community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/{insight/InsightLuceneIndexUpdaterTest.java => bloom/BloomLuceneIndexUpdaterTest.java} (85%) diff --git a/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/InsightFieldEncoding.java b/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/BloomFieldEncoding.java similarity index 95% rename from community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/InsightFieldEncoding.java rename to community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/BloomFieldEncoding.java index cac611114c2c..eba947b716c4 100644 --- a/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/InsightFieldEncoding.java +++ b/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/BloomFieldEncoding.java @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.neo4j.kernel.api.impl.insight; +package org.neo4j.kernel.api.impl.bloom; import org.apache.lucene.document.Field; import org.apache.lucene.document.TextField; @@ -30,7 +30,7 @@ * Enumeration representing all possible property types with corresponding encodings and query structures for Lucene * schema indexes. */ -enum InsightFieldEncoding +enum BloomFieldEncoding { Number { @@ -169,7 +169,7 @@ Field encodeField( String name, Value value ) // } }; - private static final InsightFieldEncoding[] AllEncodings = values(); + private static final BloomFieldEncoding[] AllEncodings = values(); abstract String key(); @@ -178,9 +178,9 @@ Field encodeField( String name, Value value ) abstract Field encodeField( String name, Value value ); - public static InsightFieldEncoding forValue( Value value ) + public static BloomFieldEncoding forValue( Value value ) { - for ( InsightFieldEncoding encoding : AllEncodings ) + for ( BloomFieldEncoding encoding : AllEncodings ) { if ( encoding.canEncode( value ) ) { diff --git a/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/InsightIndex.java b/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/BloomIndex.java similarity index 71% rename from community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/InsightIndex.java rename to community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/BloomIndex.java index 782a9f1e0ed3..35cca918768e 100644 --- a/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/InsightIndex.java +++ b/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/BloomIndex.java @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.neo4j.kernel.api.impl.insight; +package org.neo4j.kernel.api.impl.bloom; import org.apache.lucene.analysis.en.EnglishAnalyzer; import org.apache.lucene.index.IndexWriterConfig; @@ -34,13 +34,13 @@ import static org.neo4j.kernel.api.impl.index.LuceneKernelExtensions.directoryFactory; -public class InsightIndex implements AutoCloseable +public class BloomIndex implements AutoCloseable { - private final InsightLuceneIndex nodeIndex; - private final InsightLuceneIndex relationshipIndex; + private final BloomLuceneIndex nodeIndex; + private final BloomLuceneIndex relationshipIndex; private final String[] properties; - public InsightIndex( FileSystemAbstraction fileSystem, File file, String... properties ) throws IOException + public BloomIndex( FileSystemAbstraction fileSystem, File file, String... properties ) throws IOException { this.properties = properties; Factory population = () -> IndexWriterConfigs.population( new EnglishAnalyzer() ); @@ -50,30 +50,30 @@ public InsightIndex( FileSystemAbstraction fileSystem, File file, String... prop storageBuilder.withFileSystem( fileSystem ).withIndexIdentifier( "insightNodes" ) .withDirectoryFactory( directoryFactory( false, fileSystem ) ) .withIndexRootFolder( Paths.get( file.getAbsolutePath(),"insightindex" ).toFile() ); - nodeIndex = new InsightLuceneIndex( storageBuilder.build(), partitionFactory, this.properties ); + nodeIndex = new BloomLuceneIndex( storageBuilder.build(), partitionFactory, this.properties ); nodeIndex.open(); storageBuilder = LuceneIndexStorageBuilder.create(); storageBuilder.withFileSystem( fileSystem ).withIndexIdentifier( "insightRelationships" ) .withDirectoryFactory( directoryFactory( false, fileSystem ) ) .withIndexRootFolder( Paths.get( file.getAbsolutePath(),"insightindex" ).toFile() ); - relationshipIndex = new InsightLuceneIndex( storageBuilder.build(), partitionFactory, properties ); + relationshipIndex = new BloomLuceneIndex( storageBuilder.build(), partitionFactory, properties ); relationshipIndex.open(); } - public InsightIndexTransactionEventUpdater getUpdater() throws IOException + public BloomIndexTransactionEventUpdater getUpdater() throws IOException { - WritableDatabaseInsightIndex writableNodeIndex = new WritableDatabaseInsightIndex( nodeIndex ); - WritableDatabaseInsightIndex writableRelationshipIndex = new WritableDatabaseInsightIndex( relationshipIndex ); - return new InsightIndexTransactionEventUpdater( writableNodeIndex, writableRelationshipIndex, properties ); + WritableDatabaseBloomIndex writableNodeIndex = new WritableDatabaseBloomIndex( nodeIndex ); + WritableDatabaseBloomIndex writableRelationshipIndex = new WritableDatabaseBloomIndex( relationshipIndex ); + return new BloomIndexTransactionEventUpdater( writableNodeIndex, writableRelationshipIndex, properties ); } - public InsightIndexReader getNodeReader() throws IOException + public BloomIndexReader getNodeReader() throws IOException { return nodeIndex.getIndexReader(); } - public InsightIndexReader getRelationshipReader() throws IOException + public BloomIndexReader getRelationshipReader() throws IOException { return relationshipIndex.getIndexReader(); } diff --git a/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/InsightIndexReader.java b/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/BloomIndexReader.java similarity index 90% rename from community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/InsightIndexReader.java rename to community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/BloomIndexReader.java index 1cdc0cdb255d..37d701334f82 100644 --- a/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/InsightIndexReader.java +++ b/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/BloomIndexReader.java @@ -17,11 +17,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.neo4j.kernel.api.impl.insight; +package org.neo4j.kernel.api.impl.bloom; import org.neo4j.collection.primitive.PrimitiveLongIterator; -public interface InsightIndexReader extends AutoCloseable +public interface BloomIndexReader extends AutoCloseable { PrimitiveLongIterator query( String... query ); } diff --git a/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/InsightIndexTransactionEventUpdater.java b/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/BloomIndexTransactionEventUpdater.java similarity index 84% rename from community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/InsightIndexTransactionEventUpdater.java rename to community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/BloomIndexTransactionEventUpdater.java index a9b7f2fb7883..b71302db05b7 100644 --- a/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/InsightIndexTransactionEventUpdater.java +++ b/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/BloomIndexTransactionEventUpdater.java @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.neo4j.kernel.api.impl.insight; +package org.neo4j.kernel.api.impl.bloom; import org.apache.lucene.document.Document; @@ -31,13 +31,13 @@ import org.neo4j.graphdb.event.TransactionData; import org.neo4j.graphdb.event.TransactionEventHandler; -public class InsightIndexTransactionEventUpdater implements TransactionEventHandler +public class BloomIndexTransactionEventUpdater implements TransactionEventHandler { - private final WritableDatabaseInsightIndex nodeIndex; - private final WritableDatabaseInsightIndex relationshipIndex; + private final WritableDatabaseBloomIndex nodeIndex; + private final WritableDatabaseBloomIndex relationshipIndex; private final String[] properties; - InsightIndexTransactionEventUpdater( WritableDatabaseInsightIndex nodeIndex, WritableDatabaseInsightIndex relationshipIndex, String[] properties ) + BloomIndexTransactionEventUpdater( WritableDatabaseBloomIndex nodeIndex, WritableDatabaseBloomIndex relationshipIndex, String[] properties ) { this.nodeIndex = nodeIndex; this.relationshipIndex = relationshipIndex; @@ -92,7 +92,7 @@ public void afterCommit( TransactionData data, Object state ) deleteIndexData( data.deletedNodes(), nodeIndex ); } - private void updatePropertyData( Iterable> propertyEntries, Map> state, WritableDatabaseInsightIndex nodeIndex ) + private void updatePropertyData( Iterable> propertyEntries, Map> state, WritableDatabaseBloomIndex nodeIndex ) { for ( PropertyEntry propertyEntry : propertyEntries ) { @@ -103,10 +103,10 @@ private void updatePropertyData( Iterable> propertyEntries, return; } - Document document = LuceneInsightDocumentStructure.documentRepresentingProperties( nodeId, allProperties ); + Document document = BloomInsightDocumentStructure.documentRepresentingProperties( nodeId, allProperties ); try { - nodeIndex.getIndexWriter().updateDocument( LuceneInsightDocumentStructure.newTermForChangeOrRemove( nodeId ), document ); + nodeIndex.getIndexWriter().updateDocument( BloomInsightDocumentStructure.newTermForChangeOrRemove( nodeId ), document ); } catch ( IOException e ) { @@ -123,13 +123,13 @@ private void updatePropertyData( Iterable> propertyEntries, } } - private void deleteIndexData( Iterable nodes, WritableDatabaseInsightIndex nodeIndex ) + private void deleteIndexData( Iterable nodes, WritableDatabaseBloomIndex nodeIndex ) { for ( Node node : nodes ) { try { - nodeIndex.getIndexWriter().deleteDocuments( LuceneInsightDocumentStructure.newTermForChangeOrRemove( node.getId() ) ); + nodeIndex.getIndexWriter().deleteDocuments( BloomInsightDocumentStructure.newTermForChangeOrRemove( node.getId() ) ); } catch ( IOException e ) { diff --git a/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/LuceneInsightDocumentStructure.java b/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/BloomInsightDocumentStructure.java similarity index 94% rename from community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/LuceneInsightDocumentStructure.java rename to community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/BloomInsightDocumentStructure.java index 258b998c25f5..7e51905edd78 100644 --- a/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/LuceneInsightDocumentStructure.java +++ b/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/BloomInsightDocumentStructure.java @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.neo4j.kernel.api.impl.insight; +package org.neo4j.kernel.api.impl.bloom; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; @@ -34,13 +34,13 @@ import static org.apache.lucene.document.Field.Store.YES; -class LuceneInsightDocumentStructure +class BloomInsightDocumentStructure { static final String ID_KEY = "id"; private static final ThreadLocal perThreadDocument = ThreadLocal.withInitial( DocWithId::new ); - private LuceneInsightDocumentStructure() + private BloomInsightDocumentStructure() { } @@ -65,7 +65,7 @@ public static long getNodeId( Document from ) static Field encodeValueField( String propertyKey, Value value ) { - InsightFieldEncoding encoding = InsightFieldEncoding.forValue( value ); + BloomFieldEncoding encoding = BloomFieldEncoding.forValue( value ); return encoding.encodeField( propertyKey, value ); } diff --git a/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/InsightLuceneIndex.java b/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/BloomLuceneIndex.java similarity index 83% rename from community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/InsightLuceneIndex.java rename to community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/BloomLuceneIndex.java index 5d8bf16dd90c..74691eceb90d 100644 --- a/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/InsightLuceneIndex.java +++ b/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/BloomLuceneIndex.java @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.neo4j.kernel.api.impl.insight; +package org.neo4j.kernel.api.impl.bloom; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexWriter; @@ -37,12 +37,12 @@ import static java.util.Collections.singletonMap; -class InsightLuceneIndex extends AbstractLuceneIndex +class BloomLuceneIndex extends AbstractLuceneIndex { private String[] properties; - InsightLuceneIndex( PartitionedIndexStorage indexStorage, IndexPartitionFactory partitionFactory, + BloomLuceneIndex( PartitionedIndexStorage indexStorage, IndexPartitionFactory partitionFactory, String[] properties ) { super( indexStorage, partitionFactory ); @@ -55,13 +55,13 @@ class InsightLuceneIndex extends AbstractLuceneIndex private final TaskCoordinator taskCoordinator = new TaskCoordinator( 10, TimeUnit.MILLISECONDS ); - public PartitionedInsightIndexWriter getIndexWriter( WritableDatabaseInsightIndex writableIndex ) throws IOException + public PartitionedInsightBloomWriter getIndexWriter( WritableDatabaseBloomIndex writableIndex ) throws IOException { ensureOpen(); - return new PartitionedInsightIndexWriter( writableIndex ); + return new PartitionedInsightBloomWriter( writableIndex ); } - public InsightIndexReader getIndexReader() throws IOException + public BloomIndexReader getIndexReader() throws IOException { ensureOpen(); List partitions = getPartitions(); @@ -126,17 +126,17 @@ public void markAsFailed( String failure ) throws IOException indexStorage.storeIndexFailure( failure ); } - private SimpleInsightIndexReader createSimpleReader( List partitions ) throws IOException + private SimpleBloomIndexReader createSimpleReader( List partitions ) throws IOException { AbstractIndexPartition singlePartition = getFirstPartition( partitions ); - return new SimpleInsightIndexReader( singlePartition.acquireSearcher(), properties ); + return new SimpleBloomIndexReader( singlePartition.acquireSearcher(), properties ); } - private PartitionedInsightIndexReader createPartitionedReader( List partitions ) + private PartitionedBloomIndexReader createPartitionedReader( List partitions ) throws IOException { List searchers = acquireSearchers( partitions ); - return new PartitionedInsightIndexReader( searchers, properties ); + return new PartitionedBloomIndexReader( searchers, properties ); } } diff --git a/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/PartitionedInsightIndexReader.java b/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/PartitionedBloomIndexReader.java similarity index 74% rename from community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/PartitionedInsightIndexReader.java rename to community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/PartitionedBloomIndexReader.java index 7b448e6f5c75..a6ef97dba79a 100644 --- a/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/PartitionedInsightIndexReader.java +++ b/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/PartitionedBloomIndexReader.java @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.neo4j.kernel.api.impl.insight; +package org.neo4j.kernel.api.impl.bloom; import java.io.IOException; import java.util.List; @@ -26,30 +26,29 @@ import org.neo4j.collection.primitive.PrimitiveLongCollections; import org.neo4j.collection.primitive.PrimitiveLongIterator; -import org.neo4j.helpers.TaskCoordinator; import org.neo4j.io.IOUtils; import org.neo4j.kernel.api.impl.index.partition.PartitionSearcher; import org.neo4j.kernel.api.impl.schema.reader.IndexReaderCloseException; /** * Index reader that is able to read/sample multiple partitions of a partitioned Lucene index. - * Internally uses multiple {@link SimpleInsightIndexReader}s for individual partitions. + * Internally uses multiple {@link SimpleBloomIndexReader}s for individual partitions. * - * @see SimpleInsightIndexReader + * @see SimpleBloomIndexReader */ -class PartitionedInsightIndexReader implements InsightIndexReader +class PartitionedBloomIndexReader implements BloomIndexReader { - private final List indexReaders; + private final List indexReaders; - PartitionedInsightIndexReader( List partitionSearchers, String[] properties ) + PartitionedBloomIndexReader( List partitionSearchers, String[] properties ) { - this( partitionSearchers.stream().map( partitionSearcher -> new SimpleInsightIndexReader( partitionSearcher, + this( partitionSearchers.stream().map( partitionSearcher -> new SimpleBloomIndexReader( partitionSearcher, properties ) ) .collect( Collectors.toList() ) ); } - private PartitionedInsightIndexReader( List readers ) + private PartitionedBloomIndexReader( List readers ) { this.indexReaders = readers; } @@ -59,7 +58,7 @@ public PrimitiveLongIterator query( String... query ) return partitionedOperation( reader -> innerQuery( reader, query ) ); } - private PrimitiveLongIterator innerQuery( InsightIndexReader reader, String... query ) + private PrimitiveLongIterator innerQuery( BloomIndexReader reader, String... query ) { return reader.query( query ); @@ -79,7 +78,7 @@ public void close() } private PrimitiveLongIterator partitionedOperation( - Function readerFunction ) + Function readerFunction ) { return PrimitiveLongCollections .concat( indexReaders.parallelStream().map( readerFunction::apply ).collect( Collectors.toList() ) ); diff --git a/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/PartitionedInsightIndexWriter.java b/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/PartitionedInsightBloomWriter.java similarity index 93% rename from community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/PartitionedInsightIndexWriter.java rename to community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/PartitionedInsightBloomWriter.java index 546778f850f1..4d72807c3f8e 100644 --- a/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/PartitionedInsightIndexWriter.java +++ b/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/PartitionedInsightBloomWriter.java @@ -17,10 +17,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.neo4j.kernel.api.impl.insight; +package org.neo4j.kernel.api.impl.bloom; import org.apache.lucene.document.Document; -import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.Term; import org.apache.lucene.search.Query; @@ -29,7 +28,6 @@ import java.util.List; import org.neo4j.kernel.api.impl.index.partition.AbstractIndexPartition; -import org.neo4j.kernel.api.impl.schema.writer.LuceneIndexWriter; /** * Schema Lucene index writer implementation that supports writing into multiple partitions and creates partitions @@ -39,16 +37,16 @@ * {@link #MAXIMUM_PARTITION_SIZE}. * First observable partition that satisfy writer criteria is used for writing. */ -class PartitionedInsightIndexWriter +class PartitionedInsightBloomWriter { - private final WritableDatabaseInsightIndex index; + private final WritableDatabaseBloomIndex index; // by default we still keep a spare of 10% to the maximum partition size: During concurrent updates // it could happen that 2 threads reserve space in a partition (without claiming it by doing addDocument): private final Integer MAXIMUM_PARTITION_SIZE = Integer.getInteger( "luceneSchemaIndex.maxPartitionSize", IndexWriter.MAX_DOCS - (IndexWriter.MAX_DOCS / 10) ); - PartitionedInsightIndexWriter( WritableDatabaseInsightIndex index ) throws IOException + PartitionedInsightBloomWriter( WritableDatabaseBloomIndex index ) throws IOException { this.index = index; } diff --git a/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/SimpleInsightIndexReader.java b/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/SimpleBloomIndexReader.java similarity index 93% rename from community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/SimpleInsightIndexReader.java rename to community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/SimpleBloomIndexReader.java index c5dc1094c99e..34c86c6788ab 100644 --- a/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/SimpleInsightIndexReader.java +++ b/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/SimpleBloomIndexReader.java @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.neo4j.kernel.api.impl.insight; +package org.neo4j.kernel.api.impl.bloom; import org.apache.lucene.analysis.en.EnglishAnalyzer; import org.apache.lucene.queryparser.classic.MultiFieldQueryParser; @@ -40,16 +40,16 @@ /** * Schema index reader that is able to read/sample a single partition of a partitioned Lucene index. * - * @see PartitionedInsightIndexReader + * @see PartitionedBloomIndexReader */ -class SimpleInsightIndexReader implements InsightIndexReader +class SimpleBloomIndexReader implements BloomIndexReader { private final PartitionSearcher partitionSearcher; private final EnglishAnalyzer analyzer; private String[] properties; private final QueryParser multiFieldQueryParser; - SimpleInsightIndexReader( PartitionSearcher partitionSearcher, String[] properties ) + SimpleBloomIndexReader( PartitionSearcher partitionSearcher, String[] properties ) { this.partitionSearcher = partitionSearcher; this.properties = properties; diff --git a/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/WritableDatabaseInsightIndex.java b/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/WritableDatabaseBloomIndex.java similarity index 77% rename from community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/WritableDatabaseInsightIndex.java rename to community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/WritableDatabaseBloomIndex.java index ed4818fb28c9..eb9c7e8376ad 100644 --- a/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/insight/WritableDatabaseInsightIndex.java +++ b/community/lucene-index/src/main/java/org/neo4j/kernel/api/impl/bloom/WritableDatabaseBloomIndex.java @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.neo4j.kernel.api.impl.insight; +package org.neo4j.kernel.api.impl.bloom; import java.io.IOException; import java.util.List; @@ -25,22 +25,22 @@ import org.neo4j.kernel.api.impl.index.WritableAbstractDatabaseIndex; import org.neo4j.kernel.api.impl.index.partition.AbstractIndexPartition; -class WritableDatabaseInsightIndex extends WritableAbstractDatabaseIndex +class WritableDatabaseBloomIndex extends WritableAbstractDatabaseIndex { - private InsightLuceneIndex insightLuceneIndex; + private BloomLuceneIndex bloomLuceneIndex; - WritableDatabaseInsightIndex( InsightLuceneIndex insightLuceneIndex ) + WritableDatabaseBloomIndex( BloomLuceneIndex bloomLuceneIndex ) { - super( insightLuceneIndex ); - this.insightLuceneIndex = insightLuceneIndex; + super( bloomLuceneIndex ); + this.bloomLuceneIndex = bloomLuceneIndex; } - public PartitionedInsightIndexWriter getIndexWriter() throws IOException + public PartitionedInsightBloomWriter getIndexWriter() throws IOException { - return insightLuceneIndex.getIndexWriter( this ); + return bloomLuceneIndex.getIndexWriter( this ); } - public InsightIndexReader getIndexReader() throws IOException + public BloomIndexReader getIndexReader() throws IOException { return luceneIndex.getIndexReader(); } diff --git a/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/insight/InsightLuceneIndexUpdaterTest.java b/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/bloom/BloomLuceneIndexUpdaterTest.java similarity index 85% rename from community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/insight/InsightLuceneIndexUpdaterTest.java rename to community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/bloom/BloomLuceneIndexUpdaterTest.java index ccae931f543e..1ab3218b65a9 100644 --- a/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/insight/InsightLuceneIndexUpdaterTest.java +++ b/community/lucene-index/src/test/java/org/neo4j/kernel/api/impl/bloom/BloomLuceneIndexUpdaterTest.java @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.neo4j.kernel.api.impl.insight; +package org.neo4j.kernel.api.impl.bloom; import org.junit.ClassRule; import org.junit.Rule; @@ -39,7 +39,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -public class InsightLuceneIndexUpdaterTest +public class BloomLuceneIndexUpdaterTest { @ClassRule public static FileSystemRule fileSystemRule = new DefaultFileSystemRule(); @@ -55,9 +55,9 @@ public class InsightLuceneIndexUpdaterTest public void shouldFindNodeWithString() throws Exception { GraphDatabaseAPI db = dbRule.getGraphDatabaseAPI(); - try ( InsightIndex insightIndex = new InsightIndex( fileSystemRule, testDirectory.graphDbDir(), "prop" ) ) + try ( BloomIndex bloomIndex = new BloomIndex( fileSystemRule, testDirectory.graphDbDir(), "prop" ) ) { - db.registerTransactionEventHandler( insightIndex.getUpdater() ); + db.registerTransactionEventHandler( bloomIndex.getUpdater() ); long firstID; long secondID; @@ -74,7 +74,7 @@ public void shouldFindNodeWithString() throws Exception tx.success(); } - try ( InsightIndexReader reader = insightIndex.getNodeReader() ) + try ( BloomIndexReader reader = bloomIndex.getNodeReader() ) { assertEquals( firstID, reader.query( "hello" ).next() ); @@ -89,9 +89,9 @@ public void shouldFindNodeWithString() throws Exception public void shouldRepresentPropertyChanges() throws Exception { GraphDatabaseAPI db = dbRule.getGraphDatabaseAPI(); - try ( InsightIndex insightIndex = new InsightIndex( fileSystemRule, testDirectory.graphDbDir(), "prop" ) ) + try ( BloomIndex bloomIndex = new BloomIndex( fileSystemRule, testDirectory.graphDbDir(), "prop" ) ) { - db.registerTransactionEventHandler( insightIndex.getUpdater() ); + db.registerTransactionEventHandler( bloomIndex.getUpdater() ); long firstID; long secondID; @@ -117,7 +117,7 @@ public void shouldRepresentPropertyChanges() throws Exception tx.success(); } - try ( InsightIndexReader reader = insightIndex.getNodeReader() ) + try ( BloomIndexReader reader = bloomIndex.getNodeReader() ) { assertFalse( reader.query( "hello" ).hasNext() ); @@ -137,9 +137,9 @@ public void shouldRepresentPropertyChanges() throws Exception public void shouldNotFindRemovedNodes() throws Exception { GraphDatabaseAPI db = dbRule.getGraphDatabaseAPI(); - try ( InsightIndex insightIndex = new InsightIndex( fileSystemRule, testDirectory.graphDbDir(), "prop" ) ) + try ( BloomIndex bloomIndex = new BloomIndex( fileSystemRule, testDirectory.graphDbDir(), "prop" ) ) { - db.registerTransactionEventHandler( insightIndex.getUpdater() ); + db.registerTransactionEventHandler( bloomIndex.getUpdater() ); long firstID; long secondID; @@ -164,7 +164,7 @@ public void shouldNotFindRemovedNodes() throws Exception tx.success(); } - try ( InsightIndexReader reader = insightIndex.getNodeReader() ) + try ( BloomIndexReader reader = bloomIndex.getNodeReader() ) { assertFalse( reader.query( "hello" ).hasNext() ); @@ -179,9 +179,9 @@ public void shouldNotFindRemovedNodes() throws Exception public void shouldOnlyIndexIndexedProperties() throws Exception { GraphDatabaseAPI db = dbRule.getGraphDatabaseAPI(); - try ( InsightIndex insightIndex = new InsightIndex( fileSystemRule, testDirectory.graphDbDir(), "prop" ) ) + try ( BloomIndex bloomIndex = new BloomIndex( fileSystemRule, testDirectory.graphDbDir(), "prop" ) ) { - db.registerTransactionEventHandler( insightIndex.getUpdater() ); + db.registerTransactionEventHandler( bloomIndex.getUpdater() ); long firstID; long secondID; @@ -198,7 +198,7 @@ public void shouldOnlyIndexIndexedProperties() throws Exception tx.success(); } - try ( InsightIndexReader reader = insightIndex.getNodeReader() ) + try ( BloomIndexReader reader = bloomIndex.getNodeReader() ) { PrimitiveLongIterator hello = reader.query( "hello" ); @@ -213,9 +213,9 @@ public void shouldOnlyIndexIndexedProperties() throws Exception public void shouldSearchAcrossMultipleProperties() throws Exception { GraphDatabaseAPI db = dbRule.getGraphDatabaseAPI(); - try ( InsightIndex insightIndex = new InsightIndex( fileSystemRule, testDirectory.graphDbDir(), "prop", "prop2" ) ) + try ( BloomIndex bloomIndex = new BloomIndex( fileSystemRule, testDirectory.graphDbDir(), "prop", "prop2" ) ) { - db.registerTransactionEventHandler( insightIndex.getUpdater() ); + db.registerTransactionEventHandler( bloomIndex.getUpdater() ); long firstID; long secondID; @@ -236,7 +236,7 @@ public void shouldSearchAcrossMultipleProperties() throws Exception tx.success(); } - try ( InsightIndexReader reader = insightIndex.getNodeReader() ) + try ( BloomIndexReader reader = bloomIndex.getNodeReader() ) { PrimitiveLongIterator iterator = reader.query( "tomtar", "karl" ); @@ -251,9 +251,9 @@ public void shouldSearchAcrossMultipleProperties() throws Exception public void shouldOrderResultsBasedOnRelevance() throws Exception { GraphDatabaseAPI db = dbRule.getGraphDatabaseAPI(); - try ( InsightIndex insightIndex = new InsightIndex( fileSystemRule, testDirectory.graphDbDir(), "first", "last" ) ) + try ( BloomIndex bloomIndex = new BloomIndex( fileSystemRule, testDirectory.graphDbDir(), "first", "last" ) ) { - db.registerTransactionEventHandler( insightIndex.getUpdater() ); + db.registerTransactionEventHandler( bloomIndex.getUpdater() ); long firstID; long secondID; @@ -281,7 +281,7 @@ public void shouldOrderResultsBasedOnRelevance() throws Exception tx.success(); } - try ( InsightIndexReader reader = insightIndex.getNodeReader() ) + try ( BloomIndexReader reader = bloomIndex.getNodeReader() ) { PrimitiveLongIterator iterator = reader.query( "Tom", "Hanks" ); @@ -297,9 +297,9 @@ public void shouldOrderResultsBasedOnRelevance() throws Exception public void shouldDifferentiateNodesAndRelationships() throws Exception { GraphDatabaseAPI db = dbRule.getGraphDatabaseAPI(); - try ( InsightIndex insightIndex = new InsightIndex( fileSystemRule, testDirectory.graphDbDir(), "prop" ) ) + try ( BloomIndex bloomIndex = new BloomIndex( fileSystemRule, testDirectory.graphDbDir(), "prop" ) ) { - db.registerTransactionEventHandler( insightIndex.getUpdater() ); + db.registerTransactionEventHandler( bloomIndex.getUpdater() ); long firstNodeID; long secondNodeID; @@ -324,7 +324,7 @@ public void shouldDifferentiateNodesAndRelationships() throws Exception tx.success(); } - try ( InsightIndexReader reader = insightIndex.getNodeReader() ) + try ( BloomIndexReader reader = bloomIndex.getNodeReader() ) { PrimitiveLongIterator hello = reader.query( "hello" ); @@ -336,7 +336,7 @@ public void shouldDifferentiateNodesAndRelationships() throws Exception PrimitiveLongIterator different = reader.query( "different" ); assertFalse( different.hasNext() ); } - try ( InsightIndexReader reader = insightIndex.getRelationshipReader() ) + try ( BloomIndexReader reader = bloomIndex.getRelationshipReader() ) { PrimitiveLongIterator hello = reader.query( "hello" );