ducbavu531
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Forum: Plugins
In reply to: [WP Search with Algolia] ACF relationshipThanks for the clarification.
Forum: Plugins
In reply to: [WP Search with Algolia] ACF relationshipdoes the instruction in the document only apply to Autocomplete? If so, how do I make it work for Instantsearch?
The code below is what I haveadd_filter( 'algolia_product_posts_index_settings', 'my_posts_index_settings' ); // We could also have used a more general hook 'algolia_posts_index_settings', // but in that case we would have needed to add a check on the post type // to ensure we only adjust settings for the 'speaker' post_type. /** @param array $settings * @return array */ function my_posts_index_settings( array $settings ) { // Make Algolia search the 'bio' field when searching for results. // Using ordered instead of unordered will make words matching in the beginning of the attribute score higher. // @see https://www.algolia.com/doc/api-reference/api-parameters/searchableAttributes/ $settings['searchableAttributes'][] = 'unordered(product_ingredients)'; // Make Algolia return a pre-computed snippet of 50 chars as part of the result set. // @see https://www.algolia.com/doc/api-reference/api-parameters/#highlighting-snippeting $settings['attributesToSnippet'][] = 'product_ingredients:50'; // Always return the value we are filtering. return $settings; }
Viewing 2 replies - 1 through 2 (of 2 total)