Using ArangoSearch LIKE to search for a string with space

509 Views Asked by At

I created an ArangoSearch view over a collection and am using the SEARCH keyword with wildcards w/ LIKE to search a field with spaces, similarly to how MySQL would. The problem I am running in to is, I keep getting an empty set even though records with the Star Wars title definitely exist.

Note, searching for '%star%' works and returns results... as soon as I add a space and search for '%star wars%' the query returns empty set.

This is the query

FOR d IN imdb_norm
SEARCH ANALYZER(d.name LIKE "%Star Wars%", "text_en")
RETURN d.name

This is the structure, running arango version 3.7.2

enter image description here

1

There are 1 best solutions below

0
On

The thing is since you're using text_en, it breaks up strings into individual words Since all spaces are considered as break characters, there is not a single term (a word stored in aragnosearch index) containing a whitespace. If you don't need tokenization, please can consider indexing a word as it is (i.e. without case conversion, accent removal, etc) using identity analyzer, or check out norm analyzer instead.

https://www.arangodb.com/docs/stable/arangosearch-analyzers.html#analyzer-types