Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-02-2022 10:56 PM
Hi,
My DB has around 2 million nodes(10 different types of nodes) and 3 million relationships in total.
Problem:
I want to run a query on the DB and select a set of nodes (similar type) based on the presence of a keyword(or phrase) in one of their fields called 'Description'.
'Description' field is plaintext (around 10 lines of text).
So, I tried to make a Full-text search index on this field using the following command.
CREATE FULLTEXT INDEX Descriptions FOR (n:Nodename) ON EACH [n.Description]
This command completes after 1 second without any errors, and I can see the newly created index in the list of indexes.
But when I try to run my query, nothing returns. I guess there is something wrong with the index because I believe index creating should take some time in a massive DB like mine.
I used the following command to search and return the nodes:
CALL db.index.fulltext.queryNodes("Descriptions", "Keyword or Phrase") YIELD node, score
RETURN node.Description, score
Any idea about this problem?
Or any other solution for a fuzzy text search on a field based on a keyword/phrase?
Thanks.
05-03-2022 01:25 PM
Hello @mehdi.kh2012 and welcome to the Neo4j community
Can you try this query? I used a regex.
CALL db.index.fulltext.queryNodes("Descriptions", "(?i)*(keyword)|(phrase)*") YIELD node, score
RETURN node.description, score
Regards,
Cobra
05-03-2022 10:59 PM
Hi @Cobra, Thanks for your response.
Your command didn't retrieve anything either. I believe there is something wrong with the creation of the index. As I mentioned in my question, my index creation command completes after only 1 second. It seems to me that it is a bug. Index creation should take some time in a massive DB with millions of nodes.
05-04-2022 12:07 AM
Execute this query please:
SHOW FULLTEXT INDEXES
05-04-2022 12:35 AM
06-10-2022 01:59 PM
It looks like the property you want to index is on nodes with label "CVE". Maybe try this version of index creation:
CREATE FULLTEXT INDEX Descriptions FOR (n:CVE) ON EACH [n.Description]
05-04-2022 12:38 AM
The index is created so, can you add the PROFILE
front of the query to check if the query uses the index?
05-04-2022 12:48 AM
Can you eloborate please?
05-04-2022 01:02 AM
Execute this query in Neo4j browser:
PROFILE CALL db.index.fulltext.queryNodes("Descriptions", "(?i)*(keyword)|(phrase)*") YIELD node, score
RETURN node.description, score
05-04-2022 01:21 AM
05-04-2022 01:23 AM
I am sure that I have hundreds of matches in my DB.
All the sessions of the conference are now available online