This message was deleted.
# community-help
s
This message was deleted.
j
o
thank you!
though i don't think that's quite our problem -- it's not that we're searching HTML content, it's that we're searching documents whose text may contain sequences of characters which are also valid html
that is, I would want the result to look like this: did you
know
that <script>alert(1)</script> is an xss payload not like this: did you
know
that is an xss payload
We can engineer our way around it though, mainly by using some unlikely-to-appear string as
HighlightStartTag
and
HighlightEndTag
, HTML-escaping the result, then swapping in the hightlight HTML tags for the unlikely-to-appear strings that we used. I just assumed there would be a simpler way, since
typesense-go
defaults to using HTML tags directly as these values, and I was having a hard time reconciling that with needing to do this
j
You would have to do HTML sanitization before ingesting the data into Typesense, if you don't expect HTML data to normally occur in the dataset
mainly by using some unlikely-to-appear string as HighlightStartTag and HighlightEndTag, HTML-escaping the result, then swapping in the hightlight HTML tags
Yeah, that's the other thing I was going to suggest
Basically html content is no different to Typesense than any other text data
Except for the <mark> tags used for highlighting by default, but that can be changed to any arbitrary string, not HTML tags necessarily
o
got it, thank you for your help 🙂
👍 1
It seems to me to be a strange design choice to default to using an HTML tag as the highlight boundaries, when they cannot be used safely in this manner. But regardless, we can work around it with minimal difficulty
j
In majority of use-cases for Typesense, documents are text-based without any HTML tags, displayed on a web-page. So that's the reason we've set html tags as the default markers, to make this common use-case work without any additional configuration
o
makes sense, thanks again
👍 1