0
我在Solr中設置了一個全新的代碼,並沒有更改任何默認設置。我索引兩個下列文件:查詢Solr時出現奇怪的行爲
<add>
<doc>
<field name="id">weight loss</field>
<field name="text_en">weight loss</field>
</doc>
</add>
和
<add>
<doc>
<field name="id">weight loss2</field>
<field name="text_en">I strongly suspect that weight loss .</field>
</doc>
</add>
我執行一個簡單的一句簡單的話查詢:
select?hl.fl=text_en&hl=on&indent=on&q="weight loss"&wt=json
我得到這兩個文件的結果,但沒有高亮!
"response":{"numFound":2,"start":0,"docs":[
{
"id":"weight loss",
"text_en":["weight loss"],
"_version_":1545688757336801280},
{
"id":"weight loss2",
"text_en":["I strongly suspect that weight loss ."],
"_version_":1545688757344141312}]
},
"highlighting":{
"weight loss":{},
"weight loss2":{}}}
當我添加參數DF = text_en查詢前面提到的,我得到凸顯,但結果只有一個!
"response":{"numFound":1,"start":0,"docs":[
{
"id":"weight loss",
"text_en":["weight loss"],
"_version_":1545688757336801280}]
},
"highlighting":{
"weight loss":{
"text_en":["<em>weight loss</em>"]}}}
此外,當我包括DF = text_en參數,但請從短語項報價:
http://localhost:8983/solr/test2/select?df=text_en&hl.fl=text_en&hl=on&indent=on&q=weight loss&wt=json
我不明白這種行爲在所有。爲什麼我沒有在第一個案件中突出顯示?爲什麼在第二和第三種情況下分別匹配和不匹配?
您需要更改** ** text_en向** ** text_general類型的管理模式,以獲得亮點爲第二case.' <字段名=「text_en」 TYPE =「text_general 「indexed =」true「stored =」true「/>' –