Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create rule for combining multiple consequences #228

Open
eSaner opened this issue Jul 31, 2022 · 8 comments
Open

Create rule for combining multiple consequences #228

eSaner opened this issue Jul 31, 2022 · 8 comments
Labels
enhancement New feature or request

Comments

@eSaner
Copy link

eSaner commented Jul 31, 2022

I would like to add a rule in Algolia for combining multiple consequences, as described in their documentation here: https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/combining-multiple-consequences/#using-the-api

Is it possible to do this using their PHP API via WP Search With Algolia? I don't see anything in your documentation about adding rules, and though there are some rules-related methods in Searchindex.php, I don't see any obvios hooks where I could add one.

Is it your recommendation to just use the Algolia Dashboard to create rules (assuming they won't be over-written when pushing settings)?

@tw2113
Copy link
Member

tw2113 commented Aug 1, 2022

I believe the wiki page at https://github.com/WebDevStudios/wp-search-with-algolia/wiki/Index-Settings would be the examples needed here, towards the bottom. Those examples would be the hooks wanted to set custom settings for, when indexing, so that they get sent when clicking to push up settings.

List of all the hooks available are at https://github.com/WebDevStudios/wp-search-with-algolia/wiki/Filter-Hooks and https://github.com/WebDevStudios/wp-search-with-algolia/wiki/Action-Hooks

@eSaner
Copy link
Author

eSaner commented Aug 1, 2022

Algolia settings use the $index->setSettings method, but rules use $index->saveRule, so I don't think your settings hooks would work.

@eSaner
Copy link
Author

eSaner commented Aug 1, 2022

Pushing settings does not delete Rules added via the Algolia dashboard. So I can do it that way for now. Would be great if I could set this via the API and wp-search-with-algolia.

@tw2113
Copy link
Member

tw2113 commented Aug 1, 2022

The hooks should work fine, more a question of what code/endpoints etc would be getting used in the callbacks, but I'm not going to claim that definitely at the exact moment either. I do think I need to test things out yet

@tw2113
Copy link
Member

tw2113 commented Aug 2, 2022

Upon some digging in and further review, I am agreeing that the hooks are in the wrong place in terms of custom rules. The rules are a separate section outside of index configuration.

@tw2113
Copy link
Member

tw2113 commented Aug 2, 2022

Haven't quite found out if/where the saveRule method is available to us, outside of maybe just instantiating things ourselves custom. The idea being that it's maybe possible to start an object instance within a callback running on settings pushing, to push the rule as well.

@eSaner
Copy link
Author

eSaner commented Aug 3, 2022

Thanks for looking more into it! I think at this point it's just easier to use the Algolia dashboard, though I'd much prefer using the API. Consider this a feature request for a specific hook for adding Rules.

@tw2113
Copy link
Member

tw2113 commented Aug 3, 2022

Since we bundle in libraries still maintained from Algolia, I have to believe we have the tools available as a whole, but the plugin may not have been specifically set up to handle. Perhaps room for new features in the future.

That said, yes for now best to use the Dashboard.

@asharirfan asharirfan added the enhancement New feature or request label Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants