• Resolved adrien99

    (@adrien99)


    Hi,

    I have noticed a lot of queries on my Algolia dashboard and I would like to limit them. I wanted to know if re-indexing the products would cost API queries, and if so, how to limit it.

    Are there other ways to limit API queries? Currently, what I have done is trigger a query from a minimum of 3 letters, but that is not sufficient.

    Thkans !

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

    (@tw2113)

    The BenchPresser

    Are you using Autocomplete, Instantsearch, or perhaps both?

    If autocomplete, how many different content types have you enabled Autocomplete for? I’m curious if you’re using either for just what are considered “searchable posts” and if yes, you could just use the “All Posts” autocomplete option which reuses the “wp_searchable_posts” index.

    This would be different as compared to checking “Posts” and “Pages” etc which gives distinct sections in the autocomplete dropdown, but also separate indexes that would be searched.

    Thread Starter adrien99

    (@adrien99)

    Hi !

    I use both Autocomplete and Instantsearch, and I have two indexes, wp_post_product and wp_searchable_posts, which are copies and both contain 1500 records (only products). I have 1k-3k Search requests/ days…

    • This reply was modified 1 year, 8 months ago by adrien99.
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Not a definitive answer overall, but checking/reviewing the information at https://www.algolia.com/doc/guides/building-search-ui/going-further/optimize-search-request-usage/js/ won’t hurt, just to help identify sources.

    This page could potentially offer some ideas too https://support.algolia.com/hc/en-us/articles/4406981900433-Monitoring-Search-Operations

    Beyond that, it may require modifying the default templates to handle searching multiple indices in single requests. Something like found at https://www.algolia.com/doc/api-reference/api-methods/multiple-queries/?client=javascript but that’s also going to take some coding know-how with their libraries.

    Thread Starter adrien99

    (@adrien99)

    Ok thank you for this information, I have looked into all of that, and I also have a question about the indexes. I deleted one called “searchable_post” and it was recreated, how is this managed? Is a build done at regular intervals?

    View post on imgur.com

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    The searchable posts index is the one we have set up that handles the InstantSearch results as well as “All posts” from Autocomplete if you’re going with that shorthand vs specific post types for autocomplete.

    Any particular reason you’re wanting to get rid of that specific index? For example trying to make use of an index that was already created and has your intended searchable content?

    Thread Starter adrien99

    (@adrien99)

    Because i want make research only on all products and not all posts. I have two search entries (possible to see on elyamaje.com), and post_products is the good one.

    View post on imgur.com

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    If you’re wanting to limit searchable posts to only include a specific post type, say “products”, then you could use something like the following filter:

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

    This would remove things like ‘post’, ‘page’, and any other that have “exclude from search” set to false with their registration, from consideration.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Algolia number of queries’ is closed to new replies.