I had been using full-text-indexes
to search through the neo4j graph database. But in case the user enters a wrong spelling or the query doesn't match any result. Is there a way to handle this or a did you mean
kind of feature in such cases?
Also how can the search be made smarter based on the what queries a user is searching? I came across SearchKick but this doesn't have any integration with neography.
You can introduce fuzziness into your lucene query. You can do it by appending a '~' sign to your query and specify the factor, eg name:mistqke~0.8
should still find the text "mistake". The fuzziness factor is between 0 and 1. A value closer to 1 will match with a higher similarity.
If you want to combine a wildcard and a fuzzy query, you'll could use something like this:
START n=node:index('name:mistqke~0.8 or name:*mistqke*')
RETURN DISTINCT n;
Mind the 'OR' in the lucene query and 'DISTINCT' in the RETURN clause.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.