• Resolved adrien99

    (@adrien99)


    Hello,

    When I perform a search with the “Use Algolia with Instantsearch.js” option enabled, I get the correct results in the dropdown menu. However, once I press enter, instead of displaying the products on my page, it searches in “My Account” and “Wishlist”. I only want to see my own products, not all posts type, juste product.

    Link : https://imgur.com/a/n3F7CI2

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hi @adrien99

    Sounds like the autocomplete section is working just fine, but the search is being a bit too inclusive for what you’re trying to achieve here, which is exclusively indexing products for the instantsearch functionality.

    Give the following a try, as this should set the searchable content to only be a post type of product instead of all post types that are not excluded from search with their post type registration.

    function wds_algolia_override_searchable_post_types( $searchable_posts ) {
    	return [ 'product' => 'product' ];
    }
    add_filter( 'algolia_searchable_post_types', 'wds_algolia_override_searchable_post_types' );

    Once saved to your active theme’s functions.php file, you should be able to do a bulk re-index from the Search settings page and get your searchable posts index cleared out of everything except your product post type items.

    Thread Starter adrien99

    (@adrien99)

    Ok thanks, finaly i have just changed index name. It’s possible to filter only on the names of the products and not the content ?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Not quite following with that last part, are you referring to only which attributes on the objects are searched through?

    You should be able to change the searchable attributes either through code samples which I can help point to documentation for, or you can remove the post_content from being a searchable attribute via your Algolia Dashboard.

    Note that if you’re using the “Push settings” buttons in WP Search With Algolia, those will override settings managed directly from the Algolia Dashboard. Best to use one or the other.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Did you ever get this resolved @adrien99 ?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WP Search with Algolia’ is closed to new replies.