user6725114
user6725114

Reputation: 93

solr highlighting shows empty result

Hi I am new in Solr and using Solr 7.0.0 running in windows 7. I created a collection and indexed folder with pdf and html files residing in a folder using the following command:

> java -jar -Dc=guidanceDoc -Dauto example\exampledocs\post.jar M:\Projects\guidance\documents\*

If I write a query, I get results. However, if I turn the hl=on, I get a section for highlights without any text.

Here is the query:

http://localhost:8983/solr/guidanceDoc/select?hl.fl=_text_&hl=on&%20q=_text_:"Home%20Use"

Here is the highlight part of the result:

"highlighting":{
    "M:\\Projects\\g1\\documents\\gg331681":{},
    "M:\\Projects\\g1\\documents\\gg209337":{},
    "M:\\Projects\\g1\\documents\\ggM380327":{},
    "M:\\Projects\\g1\\documents\\gg470201":{},
    "M:\\Projects\\g1\\documents\\gg507278":{},
    "M:\\Projects\\g1\\documents\\gg073767":{},
    "M:\\Projects\\g1\\documents\\gg380325":{},
    "M:\\Projects\\g1\\documents\\gg484345":{},
    "M:\\Projects\\g1\\documents\\gg259760":{}}}

How can I make it work?

Upvotes: 1

Views: 747

Answers (1)

Mysterion
Mysterion

Reputation: 9320

Your field for a highlighting should be marked as stored=true. Since you're running Solr in cloud mode, I will recommend to use Schema API to change field definition:

curl -X POST -H 'Content-type:application/json' --data-binary '{
  "replace-field":{
     "name":"hl_field",
     "type":"text",
     "stored":true }
}' http://localhost:8983/solr/guidanceDoc/schema

Upvotes: 1

Related Questions