• Resolved marcu5p

    (@marcu5p)


    Hi

    I want to configure attributes for facets via a filter rather than the Algolia dashboard. I am using:

    function custom_posts_index_settings( array $settings ) {
    	$settings['attributesForFaceting'][] = 'resource_type, solution_category, wpml.display_name';
    	return $settings;
    }
    add_filter( 'algolia_posts_index_settings', 'custom_posts_index_settings' );

    When I push settings from the plugin it gives me a success message “Settings correctly pushed for index: searchable_posts” but doesn’t seem to work, and nothing is reflected on the dashboard or the search page. Any clues you could give me?

    Thanks as always.

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

    (@tw2113)

    The BenchPresser

    Can you try again with the change of attributesForFaceting to searchableAttributes ?

    It’s my understanding that the former is getting deprecated, or has been already

    Thread Starter marcu5p

    (@marcu5p)

    Hi Michael

    Thanks for your reply.

    No I’m afraid that doesn’t work either.

    Thread Starter marcu5p

    (@marcu5p)

    This works:

    function custom_posts_index_settings( array $settings ) {
    	$settings['attributesForFaceting'] = ['resource_type', 'solution_category', 'wpml.display_name', 'post_type'];
    	return $settings;
    }
    add_filter( 'algolia_searchable_posts_index_settings', 'custom_posts_index_settings' );
    add_filter( 'algolia_posts_index_settings', 'custom_posts_index_settings' );
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Ohh, I think I got momentarily confused earlier with attributes for faceting vs attributes for indexing which are different things.

    Looks like attributesForFaceting is definitely still supported and not renamed/deprecated.

    That said, sounds like you got things working now and are in a better spot.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Configure attributes for faceting issue’ is closed to new replies.