Duplicate Highlight Keys in Search Results
TLDR Manish noticed two highlight keys in search results. Jason explained "highlight" is the newer key for nested fields, while "highlights" is for backward compatibility.
1
May 26, 2023 (6 months ago)
Manish
05:43 PM "highlight": {
"chats": {
"matched_tokens": [
"help",
"docker"
],
"snippet": "wondering if anyone could <mark>help</mark> me configure my <mark>docker</mark> hosted typesense with SSL"
},
"summary": {
"matched_tokens": [
"help"
],
"snippet": " Ian asked for <mark>help</mark> with setting up SSL certificates in a Docker-hosted Typesense. Jason provided suggestions but the issue remains unresolved due to port conflict."
}
},
"highlights": [
{
"field": "chats",
"matched_tokens": [
"help",
"docker"
],
"snippet": "wondering if anyone could <mark>help</mark> me configure my <mark>docker</mark> hosted typesense with SSL"
},
{
"field": "summary",
"matched_tokens": [
"help"
],
"snippet": " Ian asked for <mark>help</mark> with setting up SSL certificates in a Docker-hosted Typesense. Jason provided suggestions but the issue remains unresolved due to port conflict."
}
],
Why is this?
Jason
06:07 PMhighlight
is the newer key which you want to use, which we had to update to once we launched the ability to index nested fields.We’ve kept the older
highlights
key for backward compatibility purposes. This key won’t contain any highlights for nested objects.We plan to deprecate the
highlights
key several versions from now…1
Manish
06:09 PMTypesense
Indexed 3011 threads (79% resolved)
Similar Threads
Creating Schema for Nested Objects in JSON
Greg asked about creating schemas for nested objects in JSON. Jason provided information about indexing nested fields in Typesense v0.24.0. PneuViz requested details about replacing the 'highlights' field with 'highlight' in the new version.
Discussing Typesense Search Highlighting Capabilities
Jack enquiries about getting highlight data to include all fields in an object on Typesense. Jason clarifies that only specific fields in 'query_by' will be returned, which resolves the issue for Jack.
Troubleshooting Typo Highlighting in Search Queries
Stefan queried "chews" and "Roche", despite having a typo distance of 4, was highlighted. Kishore Nallan requested to test on v0.20 RC. Random results like "Sachets" and "Lachesca" were also highlighted. On single record query, highlighting works. Kishore Nallan assured to address this issue in the pending release.