Skip to content

Commit

Permalink
[NOID] Ignore vector indexes when getting indexes from Neo4j. (neo4j#467
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Lojjs authored Aug 8, 2023
1 parent 5d8b332 commit 5e343dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.neo4j.graphdb.Transaction;
import org.neo4j.graphdb.schema.ConstraintDefinition;
import org.neo4j.graphdb.schema.IndexDefinition;
import org.neo4j.graphdb.schema.IndexType;
import org.neo4j.graphdb.schema.Schema;

import java.util.ArrayList;
Expand Down Expand Up @@ -80,7 +81,7 @@ public Iterable<IndexDefinition> getIndexes() {
return getDefinitions((schema, label) ->
StreamSupport
.stream(schema.getIndexes(label).spliterator(), false)
.filter(indexDefinition -> indexDefinition.getIndexType().name() != "VECTOR")
.filter(indexDefinition -> indexDefinition.getIndexType() != IndexType.VECTOR)
.toList()
);
}
Expand Down
7 changes: 4 additions & 3 deletions common/src/main/java/apoc/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.neo4j.graphdb.Result;
import org.neo4j.graphdb.schema.ConstraintType;
import org.neo4j.graphdb.schema.IndexDefinition;
import org.neo4j.graphdb.schema.IndexType;
import org.neo4j.internal.schema.ConstraintDescriptor;
import org.neo4j.kernel.impl.coreapi.InternalTransaction;
import org.neo4j.kernel.impl.util.ValueUtils;
Expand Down Expand Up @@ -1151,7 +1152,7 @@ public static int indexOf(List<Object> list, Object value) {
public static Iterable<IndexDefinition> getIndexes(Transaction transaction)
{
return StreamSupport.stream(transaction.schema().getIndexes().spliterator(), false)
.filter(indexDefinition -> indexDefinition.getIndexType().name() != "VECTOR").toList();
.filter(indexDefinition -> indexDefinition.getIndexType() != IndexType.VECTOR).toList();
}

/*
Expand All @@ -1162,7 +1163,7 @@ public static Iterable<IndexDefinition> getIndexes(Transaction transaction)
public static Iterable<IndexDefinition> getIndexes(Transaction transaction, Label label)
{
return StreamSupport.stream(transaction.schema().getIndexes(label).spliterator(), false)
.filter(indexDefinition -> indexDefinition.getIndexType().name() != "VECTOR").toList();
.filter(indexDefinition -> indexDefinition.getIndexType() != IndexType.VECTOR).toList();
}

/*
Expand All @@ -1173,6 +1174,6 @@ public static Iterable<IndexDefinition> getIndexes(Transaction transaction, Labe
public static Iterable<IndexDefinition> getIndexes(Transaction transaction, RelationshipType relType)
{
return StreamSupport.stream(transaction.schema().getIndexes(relType).spliterator(), false)
.filter(indexDefinition -> indexDefinition.getIndexType().name() != "VECTOR").toList();
.filter(indexDefinition -> indexDefinition.getIndexType() != IndexType.VECTOR).toList();
}
}

0 comments on commit 5e343dd

Please sign in to comment.