Hello, I am using neo4j full text search. I manually create the full text search index and the query works fine as well. The query is run through SDN (@Query)
However, I also have integration test to tests the functionality. These tests run the query against an embedded neo4j instance.
I would like to know how to create full text search indexes programmatically for the embedded test databases.
I get the following exception in my tests. I am aware this happens as there is no index. Thanks in advance.
Code: Neo.ClientError.Procedure.ProcedureNotFound; Description: There is no procedure with the name `db.index.fulltext.queryNodes` registered for this database instance.
Regards,
Varun
You could programmatically create the index with whatever driver you're using to interact with your instance, in the setup phase of your test and then remove it in the tear down.
This is a python example:
def create_text_index(tx):
tx.run(
"""
CALL db.index.fulltext.createNodeIndex("yourIndex", ["node"], ["field you want to capture"])
"""
)
def destroy_text_index(tx):
tx.run(
"""
CALL db.index.fulltext.drop("yourIndex")
"""
)
def create_index():
with driver.session() as session:
session.write_transaction(create_text_index)
def destroy_index():
with driver.session() as session:
session.write_transaction(destroy_text_index)
Then you would call the respective functions in your setup and tear down.
Many thanks @MuddyBootsCode. Do you have a Java equivalent solution for this?
Regards,
Varun
I'm sorry I do not. But I would imagine the java methods aren't that much different.