diff --git a/community/community-it/index-it/src/test/java/org/neo4j/kernel/impl/newapi/NodeValueIndexCursorLuceneTest.java b/community/community-it/index-it/src/test/java/org/neo4j/kernel/impl/newapi/NodeValueIndexCursorLuceneTest.java index 95bd594d68597..a6b8b8851c46d 100644 --- a/community/community-it/index-it/src/test/java/org/neo4j/kernel/impl/newapi/NodeValueIndexCursorLuceneTest.java +++ b/community/community-it/index-it/src/test/java/org/neo4j/kernel/impl/newapi/NodeValueIndexCursorLuceneTest.java @@ -45,12 +45,6 @@ protected String providerVersion() return "1.0"; } - @Override - protected boolean spatialRangeSupport() - { - return true; - } - @Override protected boolean indexProvidesStringValues() { diff --git a/community/community-it/index-it/src/test/java/org/neo4j/kernel/impl/newapi/NodeValueIndexCursorNative10Test.java b/community/community-it/index-it/src/test/java/org/neo4j/kernel/impl/newapi/NodeValueIndexCursorNative10Test.java index 71f65e9e8bfae..d5c6f569596a6 100644 --- a/community/community-it/index-it/src/test/java/org/neo4j/kernel/impl/newapi/NodeValueIndexCursorNative10Test.java +++ b/community/community-it/index-it/src/test/java/org/neo4j/kernel/impl/newapi/NodeValueIndexCursorNative10Test.java @@ -43,12 +43,6 @@ protected String providerVersion() return "1.0"; } - @Override - protected boolean spatialRangeSupport() - { - return true; - } - @Override protected boolean indexProvidesStringValues() { diff --git a/community/community-it/index-it/src/test/java/org/neo4j/kernel/impl/newapi/NodeValueIndexCursorNative20Test.java b/community/community-it/index-it/src/test/java/org/neo4j/kernel/impl/newapi/NodeValueIndexCursorNative20Test.java index 18eba1619666e..f4220d8fefa33 100644 --- a/community/community-it/index-it/src/test/java/org/neo4j/kernel/impl/newapi/NodeValueIndexCursorNative20Test.java +++ b/community/community-it/index-it/src/test/java/org/neo4j/kernel/impl/newapi/NodeValueIndexCursorNative20Test.java @@ -43,12 +43,6 @@ protected String providerVersion() return "2.0"; } - @Override - protected boolean spatialRangeSupport() - { - return true; - } - @Override protected boolean indexProvidesStringValues() { diff --git a/community/community-it/kernel-it/src/test/java/org/neo4j/kernel/impl/newapi/NodeValueIndexCursorInMemoryTest.java b/community/community-it/kernel-it/src/test/java/org/neo4j/kernel/impl/newapi/NodeValueIndexCursorGenericTest.java similarity index 68% rename from community/community-it/kernel-it/src/test/java/org/neo4j/kernel/impl/newapi/NodeValueIndexCursorInMemoryTest.java rename to community/community-it/kernel-it/src/test/java/org/neo4j/kernel/impl/newapi/NodeValueIndexCursorGenericTest.java index 5476a6dbd3fda..3a4ed24dfdaf7 100644 --- a/community/community-it/kernel-it/src/test/java/org/neo4j/kernel/impl/newapi/NodeValueIndexCursorInMemoryTest.java +++ b/community/community-it/kernel-it/src/test/java/org/neo4j/kernel/impl/newapi/NodeValueIndexCursorGenericTest.java @@ -19,30 +19,28 @@ */ package org.neo4j.kernel.impl.newapi; -public class NodeValueIndexCursorInMemoryTest extends AbstractNodeValueIndexCursorTest +import org.neo4j.graphdb.factory.GraphDatabaseSettings; + +public class NodeValueIndexCursorGenericTest extends AbstractNodeValueIndexCursorTest { @Override public ReadTestSupport newTestSupport() { - return new ReadTestSupport(); + ReadTestSupport readTestSupport = new ReadTestSupport(); + readTestSupport.addSetting( GraphDatabaseSettings.default_schema_provider, GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10.providerIdentifier() ); + return readTestSupport; } @Override protected String providerKey() { - return "lucene+native"; + return GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10.providerName(); } @Override protected String providerVersion() { - return "2.0"; - } - - @Override - protected boolean spatialRangeSupport() - { - return false; + return GraphDatabaseSettings.SchemaIndex.NATIVE_BTREE10.providerVersion(); } @Override diff --git a/community/kernel-api/src/test/java/org/neo4j/internal/kernel/api/NodeValueIndexCursorTestBase.java b/community/kernel-api/src/test/java/org/neo4j/internal/kernel/api/NodeValueIndexCursorTestBase.java index 28e9f766ae616..e01686bb4307b 100644 --- a/community/kernel-api/src/test/java/org/neo4j/internal/kernel/api/NodeValueIndexCursorTestBase.java +++ b/community/kernel-api/src/test/java/org/neo4j/internal/kernel/api/NodeValueIndexCursorTestBase.java @@ -41,7 +41,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; -import static org.junit.Assume.assumeTrue; import static org.neo4j.graphdb.Label.label; import static org.neo4j.values.storable.CoordinateReferenceSystem.Cartesian; import static org.neo4j.values.storable.CoordinateReferenceSystem.Cartesian_3D; @@ -133,7 +132,6 @@ void createTestGraph( GraphDatabaseService graphDb ) protected abstract void createCompositeIndex( GraphDatabaseService graphDb, String label, String... properties ) throws Exception; protected abstract String providerKey(); protected abstract String providerVersion(); - protected abstract boolean spatialRangeSupport(); protected abstract boolean indexProvidesStringValues(); protected abstract boolean indexProvidesNumericValues(); @@ -480,8 +478,6 @@ public void shouldPerformTemporalRangeSearch() throws KernelException @Test public void shouldPerformSpatialRangeSearch() throws KernelException { - assumeTrue( spatialRangeSupport() ); - // given boolean needsValues = indexProvidesSpatialValues(); int label = token.nodeLabel( "Node" ); @@ -663,8 +659,6 @@ public void shouldRespectOrderCapabilitiesForTemporal() throws KernelException @Test public void shouldRespectOrderCapabilitiesForSpatial() throws KernelException { - assumeTrue( spatialRangeSupport() ); - // given boolean needsValues = indexProvidesSpatialValues(); int label = token.nodeLabel( "Node" ); @@ -684,6 +678,30 @@ public void shouldRespectOrderCapabilitiesForSpatial() throws KernelException } } + @Test + public void shouldRespectOrderCapabilitiesForStringArray() throws KernelException + { + // given + boolean needsValues = indexProvidesSpatialValues(); + int label = token.nodeLabel( "Node" ); + int prop = token.propertyKey( "prop" ); + IndexReference index = schemaRead.index( label, prop ); + IndexOrder[] orderCapabilities = index.orderCapability( ValueCategory.TEXT_ARRAY ); + try ( NodeValueIndexCursor node = cursors.allocateNodeValueIndexCursor() ) + { + for ( IndexOrder orderCapability : orderCapabilities ) + { + // when + read.nodeIndexSeek( index, node, orderCapability, needsValues, IndexQuery.range( prop, + Values.of( new String[]{"first", "second", "third"} ), true, + Values.of( new String[]{"fourth", "fifth", "sixth", "seventh"} ), true ) ); + + // then + assertFoundNodesInOrder( node, orderCapability ); + } + } + } + @Test public void shouldRespectOrderCapabilitiesForWildcard() throws Exception { diff --git a/community/values/src/main/java/org/neo4j/values/storable/ValueCategory.java b/community/values/src/main/java/org/neo4j/values/storable/ValueCategory.java index 0450aa4c4ea45..06c1a7229e7be 100644 --- a/community/values/src/main/java/org/neo4j/values/storable/ValueCategory.java +++ b/community/values/src/main/java/org/neo4j/values/storable/ValueCategory.java @@ -22,11 +22,15 @@ public enum ValueCategory { NUMBER, + NUMBER_ARRAY, TEXT, + TEXT_ARRAY, GEOMETRY, - TEMPORAL, GEOMETRY_ARRAY, - REST, + TEMPORAL, + TEMPORAL_ARRAY, + BOOLEAN, + BOOLEAN_ARRAY, UNKNOWN, NO_CATEGORY } diff --git a/community/values/src/main/java/org/neo4j/values/storable/ValueGroup.java b/community/values/src/main/java/org/neo4j/values/storable/ValueGroup.java index 546cba6955593..615865ffc6500 100644 --- a/community/values/src/main/java/org/neo4j/values/storable/ValueGroup.java +++ b/community/values/src/main/java/org/neo4j/values/storable/ValueGroup.java @@ -20,8 +20,8 @@ package org.neo4j.values.storable; import static org.neo4j.values.storable.ValueCategory.NO_CATEGORY; -import static org.neo4j.values.storable.ValueCategory.REST; import static org.neo4j.values.storable.ValueCategory.TEMPORAL; +import static org.neo4j.values.storable.ValueCategory.TEMPORAL_ARRAY; /** * The ValueGroup is the logical group or type of a Value. For example byte, short, int and long are all attempting @@ -37,15 +37,15 @@ public enum ValueGroup { UNKNOWN( ValueCategory.UNKNOWN ), GEOMETRY_ARRAY( ValueCategory.GEOMETRY_ARRAY ), - ZONED_DATE_TIME_ARRAY( REST ), - LOCAL_DATE_TIME_ARRAY( REST ), - DATE_ARRAY( REST ), - ZONED_TIME_ARRAY( REST ), - LOCAL_TIME_ARRAY( REST ), - DURATION_ARRAY( REST ), - TEXT_ARRAY( REST ), - BOOLEAN_ARRAY( REST ), - NUMBER_ARRAY( REST ), + ZONED_DATE_TIME_ARRAY( TEMPORAL_ARRAY ), + LOCAL_DATE_TIME_ARRAY( TEMPORAL_ARRAY ), + DATE_ARRAY( TEMPORAL_ARRAY ), + ZONED_TIME_ARRAY( TEMPORAL_ARRAY ), + LOCAL_TIME_ARRAY( TEMPORAL_ARRAY ), + DURATION_ARRAY( TEMPORAL_ARRAY ), + TEXT_ARRAY( ValueCategory.TEXT_ARRAY ), + BOOLEAN_ARRAY( ValueCategory.BOOLEAN_ARRAY ), + NUMBER_ARRAY( ValueCategory.NUMBER_ARRAY ), GEOMETRY( ValueCategory.GEOMETRY ), ZONED_DATE_TIME( TEMPORAL ), LOCAL_DATE_TIME( TEMPORAL ), @@ -54,7 +54,7 @@ public enum ValueGroup LOCAL_TIME( TEMPORAL ), DURATION( TEMPORAL ), TEXT( ValueCategory.TEXT ), - BOOLEAN( REST ), + BOOLEAN( ValueCategory.BOOLEAN ), NUMBER( ValueCategory.NUMBER ), NO_VALUE( NO_CATEGORY );