algolia / algoliasearch-wordpress

❌🗑🙅‍♂️ Algolia Search plugin for WordPress is no longer supported. Please use our API client guide instead
https://www.algolia.com/doc/integration/wordpress/getting-started/quick-start/
GNU General Public License v2.0
358 stars 114 forks source link

Rate Limiting Index Operations #752

Open pleek91 opened 6 years ago

pleek91 commented 6 years ago

Is there a way to rate limit index operations? My site is using 100s of thousands of indexing operations. Which seems excessive. Is there a way to limit the number of indexing operations or choose how often a post is indexed?

I’m assuming posts are reindexed every time they are updated. But in this case I have thousands of posts (type product) being updated every day. But they don’t need to be reindexed each time.

I love this plugin/product but I’ll have to stop using it if I have to keep paying for unnecessary indexing operations.

rayrutjes commented 6 years ago

Hello @pleek91 ,

Could you tell me a bit more about was is qualified as "unnecessary" indexing operations? The plugin does its best at keeping your data in sync with Algolia. That is what most users expect by default.

You can disable auto synchronization and re-index manually whenever you see fit: https://community.algolia.com/wordpress/indexing-flow.html#queue-processing

You can also leverage the wp-cli command and run a cron on that every week or month: https://community.algolia.com/wordpress/wp-cli.html

Let me know if that helps,

pleek91 commented 6 years ago

@rayrutjes

Thanks for your response. They're unnecessary operations for my project as the piece of data I'm updating doesn't affect my search results. So I'm using up thousands of indexing operations with little benefit to my application.

I agree keeping the data in sync is the expected behavior, no complaints there. But since my site updates thousands of posts each day its getting out of control lol.

I thought of rate limiting as a way to only do x number of index operations per day/hour/etc. But the documentation you linked to might be the solution.

Thanks!

pleek91 commented 6 years ago

So I've been messing around with those hooks and monitoring the algolia operation logs/graphs to see how each one affects the # of operations.

One thing I don't understand is every day I have thousands of delete operations. Even though no posts are being deleted. Which is weird.

Couple of questions.

  1. What is the difference between the algolia_should_index_searchable_post and the algolia_should_index_post hooks? The docs doesn't really explain.
  2. What are the watchers that algolia_changes_watchers filters? The docs also doesn't provide a list, just an explanation of the types.
  3. Is there a hook that determines if a post should be synced at the time of sync? So if a post is saved, is there a hook that decides if the post should be synced? That would be useful for anyone doing mass updates (like I am) to exclude that mass updates from being synced but allow any user updates to be synced.