I have 2 arangodb collections: questions and answers. Answers are linked to question by the field question as shown in the pseudo code below:
question = {
_key: "q1",
title: "some titel one",
text: "some text two"
}
answer = {
text: "some text three"
question: "q1"
}
Now I want to search for a list of words, e.g.
"one two three"
and want to get question q1 as result, because “one” is in title, “two” in text and “three” in answer.text.
I defined a view “posts_view” which contains the collections questions and answers as links. I can search in the view with:
FOR post IN posts_view
SEARCH ANALYZER(TOKENS("one two three", "text_en") ALL == post.text, "text_en")
LET id = IS_SAME_COLLECTION("question", post) ? post._id : CONCAT("question/", post.question)
LET question = DOCUMENT(id)
RETURN DISTINCT question
but this search is only performed in the “text” fields, and if one word is contained in question.text and another is contained in answer.text, the search doesn’t match.
What is the best strategy for this task?