簡體   English   中英

SOLR在multiValue字段中返回一個值

[英]SOLR return a value in multiValue field

我是SOLR的新手,我對多值字段有疑問。

我的文檔具有以下格式:

{
"question":[
   "question 1",
   "question 2".
   "question 3"
   "question 4"
],

"answer": "Here is the answer"
}

當我搜索查詢:“ question:question 2”時,SOLR將保留文檔返回為:

{"question":[
   "question 1",
   "question 2".
   "question 3"
   "question 4"
],

"answer": "Here is the answer"}

有什么方法可以使結果僅包含“最佳”多值字段:

{
"question":[
   "question 2".
],

"answer": "Here is the answer"
}

先感謝您。

也許您可以使用“突出顯示”來捕獲找到文檔的原因。 https://lucene.apache.org/solr/guide/6_6/highlighting.html

如果以下方法不能解決您的問題,請共享您的架構文件。 question的字段類型設為

 <fieldType class="org.apache.solr.schema.TextField" name="SetOfTextField"> <analyzer> <tokenizer class="solr.StandardTokenizerFactory"/> </analyzer> </fieldType> 

並將查詢作為question:"question 2"觸發question:"question 2"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM