I am doing search in the plain text field (HTML st...
# community-help
n
I am doing search in the plain text field (HTML stripped) and display to user the original field, with HTML tags. Now how to do highlighting in such setup? Details: In schema:
Copy code
{
      "name":   "content_ind",
      "type":   "string",
      "index":  true,
      "stem":   true
    },
    {
      "name":   "content",
      "type":   "string",
      "index":  false,
      "store":  true
    }
content_ind
- *ind*exed content, NO HTML.
content
- content "as is", WITH HTML Now I search in
content_ind
and display to user
content
. It works:
Copy code
typesense.collections('test').documents().search({
            'q': searchTerm,
            ...
            'query_by': 'title, content_ind, tagsNames1, tagsNames2',
            'exclude_fields': 'content_ind'
        })
Now how to do highlighting? P.S. I think this documentation chapter https://typesense.org/docs/guide/tips-for-searching-common-types-of-data.html#html-content could be extended: would be great to read about highlighting for HTML Content.
f
Unless you have some logic on your side to augment the html with the hit itself, highlighting isn't exactly possible, as it will return the hit in terms of the raw contents of the html. You'd then have to get the highlight into the HTML yourself
1
n
I got it, thanks
🙂 1