1
votes

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?

1
To highlight a field, it should be set stored=true. cross check in schema file.Vinod
Thanks for the reply. From the admin panel it seems text is not set to stored. How can I do this change? I can't find any schema.xml file. Just for your note: I am running solr in cloud mode (solr.cmd start -e cloud).user6725114

1 Answers

1
votes

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