New to Algolia, need some direction on the best implementation solution for a WP stack

Hi - I’ve gone through the initial Algolia documentation, specific to the Wordpress integration. It gets me 80% of the way, but not sure if it’s the best solution.

Here’s what I’m trying to do:

  • I have a few hundred records, that are comprised of 3 distinct post types (location, provider, service).
  • In my my workflowi need 3 distinct search instances (or pages), each searching a specific content type.
  • For example one page would have the search be for locations, and use geo data etc, whereas the other two search instances would be just keyword matching

Here’s what I noticed so far - tell me if I’m wrong.

  • Algolia indexes everything that’s pushed up from the WP DB, into an index called “searchable_posts”.
  • At runtime, instantsearch.js returns results based on whatever logic is in place.

My questions:

  • Is it possible to modify instantsearch.js, per instance so it only returns data sets of a certain key. In my Algolia index there’s a key called “post_type_label” with values “location”, “provider” etc…
  • If no, is there a recommended solution or resources or library (PHP), to a) push up data to the Algolia index b) Use instantsearch.js with wordpress type data schemas

Ideally would like to use the Algolia wordpress plugin because it handles all the indexing already, but open to the best solution.

Thanks for any advice for a new-comer.

Hi @ldao,

You asked:

Is it possible to modify instantsearch.js, per instance so it only returns data sets of a certain key. In my Algolia index there’s a key called “post_type_label” with values “location”, “provider” etc…

If you do plan to have three separate pages, each with its own InstantSearch.js instance, then you can utilize filters (see the Guide and the API docs).

For each InstantSearch instance, customize the template (find it here) by adding your filters to the searchParameters option:

searchParameters: {
					facetingAfterDistinct: true,
		            highlightPreTag: '__ais-highlight__',
		            highlightPostTag: '__/ais-highlight__',
                    filters: 'post_type_label:location' // for example
}

However beyond the plugin, we recommend now creating your own custom WordPress integration by following this guide so that you have more granular control over indexing and features of Algolia: