简体   繁体   中英

Using ArangoSearch LIKE to search for a string with space

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

在此处输入图像描述

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 (ie 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

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM