Xiao
Xiao

Reputation: 555

For Solr dismax query, how can I get each field score?

In my application, each document is composed by four text field, namely title, keywords, summary and text. I know that I can use dismax query with "fq=title keywords summary text" to let Solr do dismax query in the four fields. The maximal relevance score in the four fields will be used as the final score. Moreover, adding score into the fl parameter, I can get the relevance score of each document against a query.

However, the problem is how to know the relevance score of each of the four fields? This is very important to me as I need to dump these scores to tune the field weight. The only way I am thinking is to open the debugQuery option and extract the returned XML to parse the score. But I think it is too complex. Does anyone have easy solution for my problem?

Upvotes: 1

Views: 725

Answers (1)

Pr Shadoko
Pr Shadoko

Reputation: 1708

No easy solution, you need to add &debugQuery=true to you query and then parse the "explain" section in the result. But please note that it can also be returned as an array for easier programatic manipulation. This is achieved by &debug.explain.structured=true and this can seriously ease your life.

Upvotes: 1

Related Questions