WebDevStudios / wp-search-with-algolia

Improve search on your site. Autocomplete is included, along with full control over look, feel and relevance.
https://wordpress.org/plugins/wp-search-with-algolia/
146 stars 55 forks source link

highlighting stops after 23rd result #344

Closed amrutadotorg closed 1 year ago

amrutadotorg commented 1 year ago

Describe the bug Hi, always highlighting stops working after 23rd result (see the screenshot). Example https://www.amruta.org/?s=Shudy+camps

Screenshot 2023-07-31 at 00 08 40

thank you

tw2113 commented 1 year ago

hmmm. Curious if that's a limitation of some sort from Algolia, as I don't believe we have implemented any limit like that intentionally, especially after 23.

amrutadotorg commented 1 year ago

The support told me that it’s expected behavior. See https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/highlighting-snippeting/js/

Do you know how in the plugin I can use the highlighted words for all results? Thank you

tw2113 commented 1 year ago

I am guessing you're referring to this section, correct? https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/highlighting-snippeting/js/#performance

If yes, then based on what I'm reading there, I'm not sure there'd be a way to get around it.

Based on how they're saying it, once a result set has 50,000 characters across all results, it stops attempting to highlight any more. So if you had 5 posts that all had 10,000 characters, and 6 results for a query, the 6th one wouldn't get highlights because the first 5 posts "ate up" that 50,000 limit.

Now if you a result set that in total didn't reach 50,000 characters cumulative, then all would get the highlighting.

amrutadotorg commented 1 year ago

I decreased the number of words in snippets which helped a little bit.