{
"responseHeader": {
"status": 0,
"QTime": 32
},
"response": {
"numFound": 21,
"start": 0,
"docs": [
{
"description": "The matte finish waves on this wedding band contrast with the high polish borders. This sharp and elegant design was finely crafted in Japan.",
"UID_PK": "8252",
},
{
"description": "This elegant ring has an Akoya cultured pearl with a band of bezel-set round diamonds making it perfect for her to wear to work or the night out.",
"UID_PK": "8142",
},
]
},
"highlighting": {
"8252": {
"description": [
" and <em>elegant</em> design was finely crafted in Japan."
]
},
"8142": {
"description": [
"This <em>elegant</em> ring has an Akoya cultured pearl with a band of bezel-set round diamonds making"
]
},
}
}
Это данные JSON, которые я получил от solr, когда установил hl=true
и hl.fl=description
. Здесь я получил тег docs
и тег highlighting
. Мне нужно проанализировать тег highlighting
, чтобы выделить «элегантный» в поле описания, которое находится в теге <em>
... еще одна вещь - UID_PK's(8252,8142)
в <highlighting>
генерируется динамически каждый раз. Подскажите, пожалуйста, как мне это сделать, если я получаю данные JSON как
$.getJSON("http://192.168.1.9:8983/solr/db/select/?wt=json&&start=0&rows=20&q="+newquery+"&sort=price asc&hl=true&hl.fl=description&hl.usePhraseHighlighter=true&json.wrf=?", function(newresult){
и синтаксический анализ
$.each(newresult.response.docs, function(i,item){
и
$.each(newresult.highlighting, function(i,hitem){