Add custom table in WordPress Algolia plugin

Hi,

I am trying to extend the WordPress Algolia plugin by creating new plugin so that I can index and get search results from custom tables. But unfortunately, I am not able to call “client” from the plugin. Could anyone help me to create new plugin which can index and search WordPress custom tables data with the help of same API credentials that is used in WordPress Algolia plugin.

Thanks in advance

1 Like

Hi @ankit.anand,

We are currently trying to build up some example plugins to showcase how to build custom Algolia plugins for WordPress.

A first plugin should be available as example by the end of the week.

In the meantime, do you mind sharing your use case more in depth? I’d gladly give you some guidance or help you bootstrap it.

1 Like

Thanks Ray for quick response.

Please review below case:
Requirements:

  1. I have different custom tables with multiple columns in WordPress database. These tables does not have any connection with default WordPress tables.
  2. I need to create indices for these tables (all columns as attributes) on Algolia and search any keywords in the same way as it is currently searching for WordPress default tables (wp_posts, wp_terms and wp_users).

Issues:

  1. I tried to implement my code with in Algolia plugin but it does not allowed me to do any changes.
  2. I tried to create my custom plugin to achieve above requirements. But I am not able to call API ($client) which is already used in Algolia WordPress plugin.
  3. I also tried to use actions and filters but it also not worked for me.
  4. I tried to use custom PHP integration in my custom plugin (The PHP API client | Algolia) but it also doesn’t worked because we could not re declare “\AlgoliaSearch\Client”.

Hoping for a solution.

Thanks
Ankit Anand

1 Like

Ok, that all makes sense.
Let me come back with a solution for you in a couple of days.

1 Like

Thank you so much Ray.

1 Like

Hi @rayrutjes ,

Any solution for my issue/case, please let me know.

Thanks
Ankit Anand

Hi @ankit.anand,

I released an example of small plugin that indexes WooCommerce orders into Algolia: GitHub - rayrutjes/wc-order-search-admin: 💵 Search for WooCommerce orders in the admin at the speed of thought with Algolia.

Please take a look at the code, and let’s discuss it further to see how to adapt it to your project.

Hi @rayrutjes,

Thank you so much. I am looking into the plugin and will let you know if it fulfill my requirements.

Thanks again,
Ankit Anand

1 Like

Hi @rayrutjes, I am also in the exact same boat s @ankit.anand. Was this a solution to @ankit.anand problem?

Hi @andrew,

If you want to really go custom, an approach would be to create your custom indexing logic with our PHP API client.

An example of simple standalone plugin can be found here: GitHub - rayrutjes/wc-order-search-admin: 💵 Search for WooCommerce orders in the admin at the speed of thought with Algolia.

Hope that can inspire you.

Let me know what you end up doing.

Best,

Hi, I think thins plugin works very close to what I’m looking for. Where can I add custom fields? or add the billing_postcode as a search column? Thanks