07-30-2023, 02:19 PM
I am migrating my application from Lucene to Solr. Solr handles highlighting a lot better, however if for instance I search the key word "city", I would expect a response like:
{
"id":"fdc3833a-0e4f-4314-ba8c",
"title": "Paris is a beautiful <b>city</b>",
"description": "The <b>city</b> is a great example of......",
}
while I am getting the following response instead:
{
"id":"fdc3833a-0e4f-4314-ba8c",
"title": "Paris is a beautiful city",
"description": "The city is a great example of......",
}
"highlighting": {
"fdc3833a-0e4f-4314-ba8c": {
"title": [
"Paris is a beautiful <b>city</b>"
],
"description": [
"The <b>city</b> is a great example of......"
]
}
}
So as you can see, instead of getting the highlighted term within the result, I am getting an extra section called highlighting and that means that my Java code has to change.
My question is: how will I get the highlight snippets in SolrJ?
{
"id":"fdc3833a-0e4f-4314-ba8c",
"title": "Paris is a beautiful <b>city</b>",
"description": "The <b>city</b> is a great example of......",
}
while I am getting the following response instead:
{
"id":"fdc3833a-0e4f-4314-ba8c",
"title": "Paris is a beautiful city",
"description": "The city is a great example of......",
}
"highlighting": {
"fdc3833a-0e4f-4314-ba8c": {
"title": [
"Paris is a beautiful <b>city</b>"
],
"description": [
"The <b>city</b> is a great example of......"
]
}
}
So as you can see, instead of getting the highlighted term within the result, I am getting an extra section called highlighting and that means that my Java code has to change.
My question is: how will I get the highlight snippets in SolrJ?