当我查询字符串的多个字段时,是否可以检索查询字词在哪个字段中找到的信息?
我想查询描述,信息,附加信息......但后来我需要知道哪个字段给出了结果因为我想给出不同的布局。
答案 0 :(得分:1)
Lucene方式:看IndexSearcher.explain(...)
。这将为Explanation
提供doc
对query
的评分。
Solr方式:添加&debugQuery=true
。我查询了collection:61
并得到了这份文件:
<doc>
<str name="collection">61</str>
...other fields...
<long name="uuid">1111</long>
</doc>
接下来是
<lst name="explain">
<str name="1111">
0.882217 = (MATCH) fieldWeight(collection:61 in 0), product of: 1.0 =
tf(termFreq(collection:61)=1) 0.882217 = idf(docFreq=8, maxDocs=8) 1.0 =
fieldNorm(field=collection, doc=0)
</str>
...
</lst>
上面基本上告诉项目1111的字段collection
的值为61
。您还可以请求debug.explain.structured
以更结构化的格式获取此解释字符串。