0

I'm newbie in SOLR and I have a problem with multi values field.

My document has the following format:

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

"answer": "Here is the answer"
}

When I search for the query: "question:question 2", SOLR returns the hold document as:

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

"answer": "Here is the answer"}

Is there any way to make the result contains only the "best" value of multi-values field:

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

"answer": "Here is the answer"
}

Thank you in advance.

Amateur
  • 151
  • 1
  • 2
  • 12

2 Answers2

1

Maybe you can use Highlighting to catch the reason why a document was found. https://lucene.apache.org/solr/guide/6_6/highlighting.html

Chrisp
  • 21
  • 3
0

Please share your schema file if following doesnt solve your problem. Have the field type of question as

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

And fire the query as question:"question 2"

Shweta Valunj
  • 148
  • 1
  • 11