Issues with Document Highlighting in API Endpoint
TLDR anuser had issues with highlighting snippets in document posted to Wah collection. Kishore Nallan suggested using highlight_full_fields
for complete text highlights.
Jul 07, 2023 (3 months ago)
anuser
10:55 PMI've created it and I'm using the documents endpoint to post new documents to the Wah collection
req body {
"id" : "2",
"page" : 10,
"book" : "p1W" ,
"text": "yes yes no lol yes"
}
then I get it with the endpoint search?q=yes and I get a snippet like this
"<mark>yes</mark> <mark>yes</mark>no lol <mark>yes</mark>"
then I post a new document with data like below:
{
"id" : "1",
"page" : 10,
"book" : "p1W" ,
"text": "<h1>B. Memperbaiki Niat</h1><strong>1. iyakah Dalam Menimba Ilmu</strong><q>iyakah, Berniat baik dalam menimba ilmu yaitu dengan bermaksud untuk mendapatkan ridha Allah ta'ala, beramal atas dasar ilmu, menghidupkan syariah, menyinari hatinya, menghiasi batinnya, mendekatkan diri kepada Allah ta'ala pada hari kiamat dan meraih terhadap apa yang telah Allah siapkan untuk orang berilmu berupa ridhaNya serta kebesaran karuniaNya.</q><strong>2. iyakah Imam Ats-Tsauri</strong><q>Sufyan ats-Tsauri berkata: "tidaklah aku memperbaiki sesuatu yang lebih berat bagiku daripada niatku"</q>"
}.
but why when I get the data from the search endpoint? q=iyakah I get the snippet results
"h1>B. Memperbaiki Niat</h1><strong>1. <mark>iyakah</mark> Dalam Menimba Ilmu</strong><q>iyakah, Berniat"
. even though the text above has more than 1 word iyakah, but what is highlighted is only 1 word iyakah.Jul 08, 2023 (3 months ago)
Kishore Nallan
01:05 AMhighlight_full_fields
if you want the whole text to be highlighted. We offer both snippet highlighting and full field highlighting.Typesense
Indexed 2779 threads (79% resolved)
Similar Threads
JavaScript Client's Return of Highlights Inquiry
Daniel questioned why the JavaScript client returned highlights in an array instead of an object. Kishore Nallan explained it was due to specific issues with statically typed languages needing defined JSON structures for parsing.
Customizing Snippets and Highlighting in Document Searches
bnfd wants to customize snippeting, highlighting and show multiple snippets in a search. Jason suggests using `snippet_threshold`, `highlight_full_fields`, opening a GitHub issue and breaking long documents into smaller parts.
Query on "weighted_score" & Issue with Synonym Highlighting
Stefan asked about "weighted_score" field and reported a possible synonym highlighting issue. Kishore Nallan clarified the use of "weighted_score". The possible synonym issue is still being investigated.