Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
02-02-2020 05:19 AM
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
02-03-2020 04:18 AM
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.
02-03-2020 03:06 PM
Many thanks @MuddyBootsCode. Do you have a Java equivalent solution for this?
Regards,
Varun
02-04-2020 02:25 AM
I'm sorry I do not. But I would imagine the java methods aren't that much different.
All the sessions of the conference are now available online