I've set up an ArangoSearch view with the goal of full text search over several text fields. I'm having the hardest time making sense of how I'm supposed to do this, and I suspect I've got the wrong mental model somehow. Bear with me through my examples of confusion and we'll get to the point...
I see a lot of example code like:
FOR doc IN imdb
SEARCH ANALYZER(doc.description IN TOKENS("dinosaur park", "text_en"), "text_en")
This seems backwards, since x IN y
is supposed to check for the presence of x
in y
, but here we should be looking for the tokens of "dinosaur park" in the doc description?
I also see example code like:
FOR doc IN imdb
SEARCH ANALYZER(TOKENS("dinosaur park", "text_en") ALL == doc.description, "text_en")
This is confusing since we're not testing equality of the tokens of "dinosaur park" against the description, we're testing for presence of the tokens in the tokens of doc.description.
I suspect what's going on is that ANALYZER() is doing some kind of implicit map operation and the expression inside is actually operating one by one on the output tokens of the "text_en" analyzer, along with some implicit reduce/aggregate operation, but I can't seem to find this documented anywhere.
Now, although I like to understand things, what I really want to do is full text search over multiple fields. Let's say my collection has a name
and description
field, my ArangoSearch view includes both fields with the text_en
analyzer. Now I want to write AQL which takes a query, tokenizes it, and looks for documents that contain all tokens anywhere in the union of both name and description. Is this possible?