algolia / jekyll-algolia

Add fast and relevant search to your Jekyll site
https://community.algolia.com/jekyll-algolia/
MIT License
214 stars 35 forks source link

object ids get deleted when content of page changes #187

Closed rishankHashout closed 2 years ago

rishankHashout commented 2 years ago

hey , I am using algolia's rules where I pin the objects ids of specific url. But if the content on that page is changed the object id is delete and rules does not works. How to tackle this problem ? Thanks

Haroenv commented 2 years ago

Using Hooks, you should be able to create a stable objectID based on your criteria instead of the current logic: https://community.algolia.com/jekyll-algolia/hooks.html#before-indexing-each

rishankHashout commented 2 years ago

the stable objectID work well when content of page is changed , but as we have frequent insertion and deletion of pages the same issue is encountered.

Haroenv commented 2 years ago

Could you explain what the ideal solution would be? if the content is changed, I'm not sure how the objectID can be stable to be pinned. What condition do you want to pin on?

rishankHashout commented 2 years ago

i want to pin the record which is from particular url , as we want to show this url in results on empty query but when the content is changed in that url the object id is changed and it doesn't work as expected.

Haroenv commented 2 years ago

Instead of pinning, you could do optional filtering if the query is empty: https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/how-to-promote-with-optional-filters/ That way you only need a stable attribute, not stable objects completely. Hope that helps!

rishankHashout commented 2 years ago

yes , that worked Thank you