简体   繁体   English

在solr突出显示下显示多个字段

[英]Display Multiple fields under solr highlighting

I have fields namely uid, name, description. 我有字段,即uid,名称,描述。 uid is the unique field and highlighting has been applied on description field. uid是唯一字段,并且突出显示已应用于描述字段。 if a query is done, it returns the data in the below format. 如果查询完成,它将以以下格式返回数据。

"highlighting":{
"123":{
  "Description":["solr is awesome"]}
  }

The above returns the uid and the description alone under highlighting. 上面仅在突出显示的情况下返回uid和说明。 I also want to show the name also under highlighting and it should look similar to this as mentioned below. 我还想在突出显示的地方显示该名称,如下所示,该名称应与此类似。

"highlighting":{
"123":{
  "Name":["solr"],
  "Description":["solr is awesome"]}
  }

hl.fl : Specifies a list of fields to highlight. hl.fl :指定要突出显示的字段列表。 Accepts a comma- or space-delimited list of fields for which Solr should generate highlighted snippets. 接受以逗号或空格分隔的字段列表,Solr应该为其生成突出显示的片段。 A wildcard of * (asterisk) can be used to match field globs, such as text_* or even * to highlight on all fields where highlighting is possible. 通配符*(星号)可用于匹配字段glob,例如text_ *或什至*可在所有可能突出显示的字段上突出显示。 When using *, consider adding hl.requireFieldMatch=true. 使用*时,请考虑添加hl.requireFieldMatch = true。

You can build a query like below : 您可以构建如下查询:

http://localhost:8983/solr/gettingstarted/select?hl=on&q=apple&wt=json&hl.fl=name,description&fl=id,name,description HTTP://本地主机:8983 / solr的/ gettingstarted /使用选择HL =&上Q =苹果&重量= JSON&hl.fl =名称,描述&FL = ID,名称,描述

Please refer the highlighting link for more info highlighting link 请参见更多信息突出显示链接突出链接

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

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