Update index ranking without re-indexing from WP

Is it possible to update the index settings via the WordPress plugin without triggering a full re-index? For example, if I wanted to build an interface where the site manager can change the ranking of specific attributes, is there a way to send that new ranking order to Algolia on it’s own so that they don’t have to sit through an entire index rebuild?

Hey @gabe,

Thanks for asking.

As for now, this is not possible.

That being said, we are about to release a version that addresses some issues.

Could you maybe open an issue on the repo explaining the feature you’d like to have implemented so that we could consider it in a future iteration?

I’m also really interested in what you are trying to achieve. Why do you want your users to be able to change the ranking? Would you mind sharing the use case?

Cheers,

Hello @rayrutjes,

We have a client that wants to be able to regularly tweak the various rankings based on customer feedback and they don’t want to have to go back to a developer each time to make those changes. Also, they wanted to keep the system within the WP admin so that their existing admin user accounts can all make these changes as needed.

I’ve tried out the newest version (2.2.3) and have noticed a few things that are either not working as expected or have become more difficult from the plugin admin side:

  1. Indexing can no longer be cancelled for searchable posts. Once an index is initiated, there doesn’t appear to be any obvious way to cancel that index. Also, it looks like the indexer now directly clears and updates the main searchable posts index, rather than create a tmp version then migrate that over. This will directly impact users on the site as the results will be incomplete while that index is being generated.
  2. Searchable indices cannot be cleared via the WP admin. Now, in order to clear an index, the user would have to log in to the Aloglia admin and clear it that way. In my case this is a breaking change as it looks like the only way to trigger a settings update is to manually clear an index prior to running a re-index.
  3. Index settings no longer update on a re-index. It looks like the plugin now goes out to verify that an index exists already, and if so, don’t rebuild the various index settings. This is useful if the plugin author doesn’t want to update those settings, but in my case, I do want to update those and I don’t see any way to override that default behavior of skipping the settings update. This is a breaking change in my case so we can’t have the client upgrade until a solution can be figured out. Ideally, a filter could be put in place in the Algolia_Index->create_index_if_not_existing() function that would allow me to manually override whether or not it re-applies the settings on a re-index.
  4. The logs and error messaging in the indexer are empty. With the newest version, if there is an error with the indexer it just sends a generic “There was an error” alert with no further details. Now that the logs feature is gone that means the only course of action is to dig in to the site logs to track down what may have happened. This isn’t a deal breaker but it was much more convenient to be able to see those logs right within the admin in the earlier versions.

Hopefully these are things that can be worked out in a future patch but for now we’ll have to keep the client on the existing version in order to not have them lose a significant portion of the functionality we’ve built.

1 Like

Hi @gabe,

I appreciate the detailed feedback. This is valuable for us.

Our main goal with this new release was to offer a more robust foundation.
We removed a lot of complexity, and solved a lot of issues regarding incompatibilities with other plugins.

Regarding your different points:

  • 1.
  • a) Indeed, there is currently no button to stop the processing in the middle of it. That being said, leaving the page would stop the indexing.
  • b) Leaving the indexing in the middle of the process, would indeed result in an incomplete index.
    Temporary indices are hard to reason about for most of the users, and was creating more friction than it was actually solving issues. Also given the new default design choices, indexing should go faster, so this should mitigate the eventual window where a user would have incomplete results.
  • c) I’d love to exchange more on the indexing subject to find the ideal solution.
    Could you tell me more about the amount of posts you are indexing and the time it takes to index them?
    I do recommend to usage of the WP-CLI re-indexing command if you have lots of them.
    You can also increase the number of posts to index per batch: https://community.algolia.com/wordpress/frequently-asked-questions.html#the-indexing-is-slow-can-i-optimize-the-required-time-
  • 2. & 3.
  • a) You are right. I think the best would be to add a button “Push settings” from the admin to reset the settings based on the local configuration.
    Please note that this change is definitely intentional, because it gives more power to users willing to fine tune relevancy / synonyms directly from within the Algolia dashboard.
    Previously, you were to loose every custom changes in the dashboard.
    In your case, does new “push settings” buttons sound like a good solution?
  • b) A “clear index” could also easily be added. Would it still be necessary if we provide the other “push settings” button?
  • c) I do like the idea of a filter to alter this behaviour. Would you like to submit a PR for this?
  • 4. The previous log system was adding a lot of custom posts to the database.
    Given we highly simplified the indexing process, we removed the advanced logging.
    Users are now free to spy on records by using filters like “algolia_post_records”.
    if an Ajax call fails during the indexing from the admin, it should output the message and error should be logged.
    I would also tend to recommend re-indexing using the WP-CLI command to get full information of what failed.

Definitely Gabe.

My goal is to make sure that you have the same power as before but it is now also to keep the simplicity of use we have for less technical users.

I hope my answer makes sense, and I’m looking forward turn this thread into concrete actions.

Points 2 and 3 can easily be addressed.
Regarding the other ones, I’m waiting for your feedback.

Cheers,

Thanks for the reply, @rayrutjes!

  1. We’re working with a fairly small amount of items to index but generating the data for each is fairly intensive and causes it to be slower. The total amount is only around 6000 and the index time is around 7-10 minutes.
    2 & 3. The Push Settings option would be great! That would pretty much eliminate the issues I’m having with the indexing as the client would no longer need to re-index the entries just to update the settings and it would eliminate the need to clear the indices from the admin as well.

Thanks for your help! We’re hoping to roll this out to several more sites in the next year and these changes would greatly improve the admin process for our clients.

1 Like

Roger that @gabe, consider it done.
You can track it here: https://github.com/algolia/algoliasearch-wordpress/issues/597
Will be done next week. (or before if I manage to free some time).

I feel like around 7 minutes is a bit long.

  • Are you using the CLI command?
  • Did you try increasing the items to index per batch?

Best,

@gabe I just release 2.3.0 which now comes with a dedicated push-settings button per index.
Let me know if that solves your issue.

Awesome! I’ll try it out and let you know, thanks!