Hi there, I am using the instantsearch in a website of a client, but I have an issue I’m not quite able to solve myself:
The site uses woocommerce to sell products.
The site is a multisite.
The plugin that connects the algolia app is only enabled on one of the 2 sites. But when I use the search function on either the app or on my website, I get results of both webshops. For example:
When I search for “Spiegel Wiesbaden Novi geborsteld messing” 2 results show up, one of either sites.
Is there any way to exclude these products from the instantsearch?
If you are unable to split the sites up into their own index (this is the recommended way), you’ll want to apply a filter to the search operation. Are you using the ‘WP Search with Algolia’ plugin? You should be able to more information here in their documentation (note - we don’t officially support this plugin but still happy to help).
The filter should pick up on an attribute that differentiates between the sites, for example:
Chiming in as one of the support engineers helping to maintain and support the “WP Search with Algolia” plugin.
Each site in the multisite definitely should get their own index, and there’s ways to prefix the index created for each site in the network, via UI settings.
That said, including attributes related to the site a piece of content comes from is also a viable solution, as Michael King mentions.
Side note as I’m trying to monitor Discourse here for requests with the plugin, our public support forum over at [WP Search with Algolia] Support | WordPress.org is also actively monitored by me, in cases where someone may want more targeted support.
You could extract the domain from the URL (using a regular expression or your method of choice) and save this as an attribute for the record. Then you could use this attribute to filter the record. You’ll want to set this facet up as ‘filter-only’ since it won’t really be used otherwise.
But, as I mentioned above, let’s double-check your settings on both sites as correcting them sharing the same index is the easiest fix and is probably better long term (for recommendations and our other advanced features)