This is a user-defined function for Neo4j which returns the cosine similarity of two strings. Internally, it uses Apache Lucene.
gradle build
Copy the built jar file found in ./build/libs/
to the Neo4j plugins
directory. For the default Neo4j plugins
path on Ubuntu 16.04+:
sudo cp ./build/libs/neo4j-cosine-similarity-plugin.jar /var/lib/neo4j/plugins/
After copying the jar file, you need to restart the Neo4j service. On Ubuntu 16.04+:
sudo service neo4j restart
Now you can use the function com.github.soroushj.cosineSimilarity
in Cypher queries:
RETURN com.github.soroushj.cosineSimilarity("String A", "String B")