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/
138 stars 54 forks source link

"ALGOLIA_SPLIT_POSTS" correct behavior? #379

Closed farinspace closed 9 months ago

farinspace commented 9 months ago

https://github.com/WebDevStudios/wp-search-with-algolia/blob/fe87240886bc04988a555e25128ffc088c25baa7/includes/indices/class-algolia-searchable-posts-index.php#L155-L157

Is the above correct behavior? if "ALGOLIA_SPLIT_POSTS" is FALSE, the content parts are split anyway but only the first part is used (e.g. array_shift).

tw2113 commented 9 months ago

Hi @farinspace

Looking at https://github.com/WebDevStudios/wp-search-with-algolia/wiki/Constants#constants-reference, here's what it says about this constant:

By setting to false, 1 post will equal 1 record but content will be truncated to fit into the Algolia payload max size.

Basically splitting posts, especially long ones, allows to get ALL of it into the index, across multiple related Algolia objects. Disabling the splitting of posts will make only one record, but it needs to be limited to the max size that Algolia allows per object. Thus it takes only what would be the first chunk.

Closing as a non actionable issue but feel free to keep discussing if needed.