• Resolved atelier64

    (@atelier64)


    In the autocomplete settings I can change the order of the indexable post types. But I don’t want to order on post types.
    Is there a possibility to order on relevance (Posts with the most number of keywords first.)

    For example when I now search for “blue cars” I see these results:
    Planes post types
    Plane Light Jets blue
    Plane Jumbo Jet blue
    Plane Airbus A300-600F
    Cars post types
    Car BMW Blue
    Car Ford Blue
    Ford Fiesta

    Every time I search something, I see planes first.
    Because Blue and cars are more relevant for cars, these result would be better:
    Cars post types
    Car BMW Blue
    Car Ford Blue
    Ford Fiesta
    Planes post types
    Plane Light Jets blue
    Plane Jumbo Jet blue
    Plane Airbus A300-600F

    Or without category subdivision:
    Car BMW Blue
    Car Ford Blue
    Plane Light Jets blue
    Plane Jumbo Jet blue
    Ford Fiesta
    Plane Airbus A300-600F

    Is this possible? Can someone point me in the right direction? Are there any codes for this that I can simply add to functions.php?

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

    (@tw2113)

    The BenchPresser

    Hi @atelier64

    The drag-n-drop ordering in the WP admin for the autocomplete section is more for ordering the subcategories, as you’ve generally already noticed. If you were to use just “All Posts” in that section, that will instead just use the searchable_posts index that the “Search Page” settings can also set up. The order that those actual results show up in, becomes dictated by Algolia at that point. That’s where configuration would come into the most play.

    Have you done any settings/configuration updates via code so far? Or have you primarily just adjusted in your Algolia.com dashboard that way? Either way is valid.

    Thread Starter atelier64

    (@atelier64)

    Thank you for your reply.
    I found the All posts row. But the problem is that I can’t use that because there are post types that should not be found. Probably there is an option or possibility to not make all posts findable (searchable_posts) in the All posts indexing?

    I did not make any custom configuration in the plugin (except css).
    Also in Algolia I didn’t make many adjustments. I mainly use the synonyms there.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    The searchable posts index is based on the “exclude from search” parameter for a given post type during registration. If it’s excluded there, then it doesn’t get considered for this index.

    Noted on not doing any settings customization thus far outside of synonyms, the rest is still going to be based on their engine determining relevance though for results and order coming in though. So you’ll want to tweak settings there.

    Thread Starter atelier64

    (@atelier64)

    When I now select All posts in the Autocomplete section, all posts are showing. That’s actually what I was looking for. I’m not completely satisfied with the results yet. I will optimize that.

    I found how to exclude the post types from search in registration post type for my own post types I created.
    Now I have only selected “All posts”. But when I also select another custom post type (cars), that has ‘exclude_from_search’ => true, than I see them in the results… So selecting another post type will override the exclude from search?

    In the Autocomplete list I see In addition to my post types, a lot of other registrations from other plugins such as Flamingo, cookie plugin, tags,…
    I see there are codes to make certain post types not searchable via functions.php if 1 of these could be found.

    Many thanks.
    You made me find the right solution.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    But when I also select another custom post type (cars), that has ‘exclude_from_search’ => true, than I see them in the results… So selecting another post type will override the exclude from search?

    The autocomplete page and the checkboxes there create their own indexes in your Algolia Dashboard and those aren’t beholden to exclude_from_search conditional parameters. So they’d once again show up in their own little section as part of the autocomplete experience.

    I also know we have the following two filters: algolia_excluded_post_types and algolia_excluded_taxonomies which I’m decently certain can be used to whittle down some of that Autocomplete settings list.

    You can see the core post types and some other 3rd party types that we exclude already at https://github.com/WebDevStudios/wp-search-with-algolia/blob/main/includes/class-algolia-settings.php#L122-L171

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Autocomplete sort on relevance’ is closed to new replies.