diff --git a/.gitignore b/.gitignore index 67dc31d..67e03ab 100755 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ temp/ docker_example/plugins/*jar settings.xml +.vscode diff --git a/README.md b/README.md index ae639db..4a02816 100755 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ mvn org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file \ ``` 2) Generate .jar file with all dependencies with `mvn package` 3) Put generated .jar file into `plugins/` folder of your neo4j instance and start the server -4) add `rdkit.index.sanitize=false` to `neo4j.conf`if you want to switch of sanitizing for indexing. If not provided `true` is assumed as default. +4) add `server.rdkit.index.sanitize=false` to `neo4j.conf`if you want to switch of sanitizing for indexing. If not provided `true` is assumed as default. 5) By executing `CALL dbms.procedures()`, you are expected to see `org.rdkit.*` procedures ### usage within Docker diff --git a/pom.xml b/pom.xml index 46cdbda..f00e2fa 100755 --- a/pom.xml +++ b/pom.xml @@ -6,18 +6,18 @@ org.neo4j.rdkit rdkit-index - 1.3.0 + 1.4.0 RDKit-Neo4j plugin jar 2.27.0 - 4.4.4 + 5.5.0 1.7.25 5.2.0 UTF-8 - 11 - 11 + 17 + 17 evgerher_license ${project.baseUri}src/main/license diff --git a/src/main/java/org/rdkit/neo4j/config/RDKitSettings.java b/src/main/java/org/rdkit/neo4j/config/RDKitSettings.java index d7836c8..f91cf20 100644 --- a/src/main/java/org/rdkit/neo4j/config/RDKitSettings.java +++ b/src/main/java/org/rdkit/neo4j/config/RDKitSettings.java @@ -21,5 +21,5 @@ import org.neo4j.graphdb.config.Setting; public class RDKitSettings implements SettingsDeclaration { - public static final Setting indexSanitize = SettingImpl.newBuilder("rdkit.index.sanitize", SettingValueParsers.BOOL, true).build(); + public static final Setting indexSanitize = SettingImpl.newBuilder("server.rdkit.index.sanitize", SettingValueParsers.BOOL, true).build(); } diff --git a/src/main/java/org/rdkit/neo4j/procedures/BaseProcedure.java b/src/main/java/org/rdkit/neo4j/procedures/BaseProcedure.java index 734cf84..06d0463 100755 --- a/src/main/java/org/rdkit/neo4j/procedures/BaseProcedure.java +++ b/src/main/java/org/rdkit/neo4j/procedures/BaseProcedure.java @@ -86,14 +86,11 @@ void checkIndexExistence(List labelNames, String indexName) { * @param properties - properties to set index on top of */ void createFullTextIndex(final String indexName, final List labelNames, final List properties) { - Map params = MapUtil.map( - "index", indexName, - "labels", labelNames, - "property", properties - ); - - tx.execute("CALL db.index.fulltext.createNodeIndex($index, $labels, $property, {analyzer: 'whitespace'} )", params); -// tx.execute("CALL db.index.fulltext.createNodeIndex($index, $labels, $property, {analyzer: 'whitespace'} )", params); + + String property = properties.stream().collect(Collectors.joining("','", "n.", "")); + + tx.execute(String.format("CREATE FULLTEXT INDEX %s FOR (n:%s) ON EACH [%s] OPTIONS {indexConfig: {`fulltext.analyzer`: 'whitespace' } }", indexName, String.join("|", labelNames), property)); + } /** diff --git a/src/main/java/org/rdkit/neo4j/procedures/SubstructureSearch.java b/src/main/java/org/rdkit/neo4j/procedures/SubstructureSearch.java index 986b96c..3721a64 100755 --- a/src/main/java/org/rdkit/neo4j/procedures/SubstructureSearch.java +++ b/src/main/java/org/rdkit/neo4j/procedures/SubstructureSearch.java @@ -68,7 +68,7 @@ public void deleteIndex() { log.info("Create whitespace node index on `fp` property"); tx.execute(String.format("DROP INDEX %s_%s IF EXISTS", Constants.Chemical.getValue(), canonicalSmilesProperty)); - tx.execute("CALL db.index.fulltext.drop($index)", MapUtil.map("index", indexName)); + tx.execute(String.format("DROP INDEX %s", indexName)); } /** diff --git a/src/test/java/org/rdkit/neo4j/index/BitSetIndexQueryingTest.java b/src/test/java/org/rdkit/neo4j/index/BitSetIndexQueryingTest.java index 830b7d4..d782473 100755 --- a/src/test/java/org/rdkit/neo4j/index/BitSetIndexQueryingTest.java +++ b/src/test/java/org/rdkit/neo4j/index/BitSetIndexQueryingTest.java @@ -46,7 +46,7 @@ public class BitSetIndexQueryingTest extends BaseTest { @Test public void testIndexing() { - graphDb.executeTransactionally("CALL db.index.fulltext.createNodeIndex('bitset', ['Molecule'], ['bits'], {analyzer: 'whitespace'} )"); + graphDb.executeTransactionally("CREATE FULLTEXT INDEX bitset FOR (n:Molecule) ON EACH [n.bits] OPTIONS {indexConfig: {`fulltext.analyzer`: 'whitespace' } }"); // build parameter maps List> maps = moleculeNameToBitSetMap.entrySet().stream().map(entry -> MapUtil.map( @@ -85,14 +85,14 @@ public void testIndexing() { return null; }); - graphDb.executeTransactionally("CALL db.index.fulltext.drop('bitset')"); // otherwise we get an exception on shutdown + graphDb.executeTransactionally("DROP INDEX bitset"); // otherwise we get an exception on shutdown } @Test public void makeSimilarityRequestTest() throws Exception { insertChemblRows(); - graphDb.executeTransactionally("CALL db.index.fulltext.createNodeIndex('bitset', ['Chemical', 'Structure'], ['fp'], {analyzer: 'whitespace'} )"); + graphDb.executeTransactionally("CREATE FULLTEXT INDEX bitset FOR (n:Chemical|Structure) ON EACH [n.fp] OPTIONS {indexConfig: {`fulltext.analyzer`: 'whitespace' } }"); final String smiles1 = "COc1ccc(C(=O)NO)cc1"; @@ -142,7 +142,7 @@ public void makeSimilarityRequestTest() throws Exception { return null; }); - graphDb.executeTransactionally("CALL db.index.fulltext.drop('bitset')"); // otherwise we get an exception on shutdown + graphDb.executeTransactionally("DROP INDEX bitset"); // otherwise we get an exception on shutdown } /** diff --git a/src/test/java/org/rdkit/neo4j/procedures/FingerprintProcedureTest.java b/src/test/java/org/rdkit/neo4j/procedures/FingerprintProcedureTest.java index 72abdce..609b0ef 100755 --- a/src/test/java/org/rdkit/neo4j/procedures/FingerprintProcedureTest.java +++ b/src/test/java/org/rdkit/neo4j/procedures/FingerprintProcedureTest.java @@ -66,7 +66,7 @@ public void createCustomFpTest() throws Exception { } graphDb.executeTransactionally("CALL org.rdkit.search.dropIndex()"); - graphDb.executeTransactionally("CALL db.index.fulltext.drop($indexName)", MapUtil.map("indexName", propertyName + "_index")); + graphDb.executeTransactionally(String.format("DROP INDEX %s", propertyName + "_index")); } @Test(expected = IllegalStateException.class) @@ -136,6 +136,6 @@ public void callSimilarityProcedureTest() throws Throwable { }); graphDb.executeTransactionally("CALL org.rdkit.search.dropIndex()"); - graphDb.executeTransactionally("CALL db.index.fulltext.drop($indexName)", MapUtil.map("indexName", propertyName + "_index")); + graphDb.executeTransactionally(String.format("DROP INDEX %s", propertyName + "_index")); } }