neo4j-contrib / neo4j-apoc-procedures

Awesome Procedures On Cypher for Neo4j - codenamed "apoc"                     If you like it, please ★ above ⇧            
https://neo4j.com/labs/apoc
Apache License 2.0
1.71k stars 493 forks source link

apoc.schema.assert drops and re-adds multi-property index every time #1577

Closed ericmonk closed 4 years ago

ericmonk commented 4 years ago

Guidelines

Please note that GitHub issues are only meant for bug reports/feature requests. If you have questions on how to use APOC, please ask on the Neo4j Discussion Forum instead of creating an issue here.

Expected Behavior (Mandatory)

It should detect that the multi-property index is the same as an existing one, and not drop it, then re-add it.

Actual Behavior (Mandatory)

Even though a multi-property index is the same, for example:

"Person": [ [ "firstName", "lastName" ] ]

It will always drop and re-add it. For single property indexes like this:

"Person": [ "name" ]

It works fine.

How to Reproduce the Problem

Create a multi-property index.

Simple Dataset (where it's possibile)

//Insert here a set of Cypher statements that helps us to reproduce the problem
CALL apoc.schema.assert(null, {
    Person: [["firstName", "lastName"]]
})

Steps (Mandatory)

  1. Use the Neo4j Web Browser
  2. Run the apoc.schema.assert example above
  3. Run it again

Screenshots (where it's possibile)

Specifications (Mandatory)

Currently used versions

Versions

conker84 commented 4 years ago

@ericmonk it always drops the indexes also for the single property version, this because you're there is a third parameter named dropExisting which is default true, can you try the following query?

CALL apoc.schema.assert(null, {
    Person: [["firstName", "lastName"]]
}, false)
conker84 commented 4 years ago

@ericmonk ping