简体   繁体   English

Solr 正在突出显示错误的单词

[英]Solr is highlighting wrong words

I have a document which is我有一个文件是

{'remaining': 'planet holly wood las vegas','id': 'c6d8e7e5-7ba9-4b68-ae0b-bb31ec4872f3'}

my query is remaining:(((mirage OR *holly* OR (planet AND hollywood)) AND (las AND vegas)) AND id:c6d8e7e5-7ba9-4b68-ae0b-bb31ec4872f3)我的查询还remaining:(((mirage OR *holly* OR (planet AND hollywood)) AND (las AND vegas)) AND id:c6d8e7e5-7ba9-4b68-ae0b-bb31ec4872f3)

in the highlighting result:在突出显示结果中:

{'c6d8e7e5-7ba9-4b68-ae0b-bb31ec4872f3': {'remaining': ['<em>planet</em> <em>holly</em> wood <em>las</em> <em>vegas</em>']}}

Why is planet being highlighted?为什么要突出显示planet I'm using solr 8.4 Thanks.我正在使用 solr 8.4 谢谢。

It's being highlighted because it's part of your query.它被突出显示,因为它是您查询的一部分。

In general highlighting works across all the tokens being matched by the query, not just those giving a hit (and by default, a hit isn't even necessary in the field you're highlighting on - just that the token from the query is present in the highlighted value).一般来说,突出显示适用于查询匹配的所有标记,而不仅仅是那些给出命中的标记(默认情况下,在您突出显示的字段中甚至不需要命中 - 只是存在来自查询的标记在突出显示的值中)。

You can tweak this slightly by using hl.requireFieldMatch , but I'm not sure if that'll work with the optional clauses in your OR statement.您可以使用hl.requireFieldMatch稍微调整hl.requireFieldMatch ,但我不确定这是否适用于OR语句中的可选子句。

hl.requireFieldMatch hl.requireFieldMatch

By default, false, all query terms will be highlighted for each field to be highlighted (hl.fl) no matter what fields the parsed query refer to.默认情况下,false,对于每个要突出显示的字段(hl.fl),无论解析的查询引用什么字段,所有查询词都将突出显示。 If set to true, only query terms aligning with the field being highlighted will in turn be highlighted.如果设置为 true,则只有与突出显示的字段对齐的查询词才会被突出显示。

The full list of highlighting options is available in the reference guide . 参考指南中提供突出显示选项的完整列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM