(10/12/23 11:56), Ruixiang Zhang wrote:
I want to print the highlighting descriptions:

{"responseHeader":{"status":0,
"QTime":2,"params":{"hl.fl":"description","json.wrf":"jsonp1293069622009","wt":"json","q":"target","hl":"true"}},"response":{"numFound":7945,"start":0,"maxScore":6.9186745,"docs":[{"description":"target","url":"target","id":"269653","score":6.9186745},{"description":"Target
The
Woodlands","url":"Target_The_Woodlands","id":"37277","score":4.3241715},{"description":"Target
Kent","url":"Target_Kent","id":"37275","score":4.3241715}]},
"highlighting":{"269653":{"description":["<em>target</em>
"]},"37277":{"description":["<em>Target</em>  The
Woodlands"]},"37275":{"description":["<em>Target</em>
Kent"]}}}

I know the descriptions in docs is:  response.response.docs[i].description
But I don't know how to print out the highlighting descriptions, such as
"<em>Target</em>  Kent" (No need to highlight, just print out).

Ruixiang,

If you meant that you want to get "Target Kent" instead of "<em>Target</em>  
Kent",
you can change <em> tags to empty string by using hl.simple.pre/hl.simple.post
parameters:

http://wiki.apache.org/solr/HighlightingParameters#hl.simple.pre.2BAC8-hl.simple.post

Koji
--
http://www.rondhuit.com/en/

Reply via email to