Accessing matched term in script score function

(Red) #1

i have some problem with script score.
i want to caculate the score with matched term.
in most situation, i just need the count of matched term.
but i want to know what term are the matched terms, and i can do some adjusting to different terms.

for query string "test A B C"
terms analyzed by index's analyzer will be: "test" "A" "B" "C"

if i just know the count of matched terms to one document, the score will be 4, 3, 2, 1 or 0.
but i want to have some extra points to term "A",
the point will be like this: A*10 + B * 1 + C * 1

someone has asked for the same problem before, but his has a little different from mine.

i need the query string analyzed by indexer's analyzer. the query string are always given by user input, i thinks its better be analyzed by es, i just have to make some policy to the terms analyzed by es.

(system) #2