• Resolved audiofoundry

    (@audiofoundry)


    Hey there!

    I’m really impressed with this plugin and the smooth nature of the integration it provides.

    However, there is an issue that I can’t seem to resolve whereby the instantsearch results page reveals pages and backend information that should not be displayed. Indeed, the results in question do not display in the Ajax drop down search results, but only appear on the results page once a user hits enter. However, I do not know why this is happening and therefore do not know how to change it.

    For example – A user searching the word ’email’ in the main search will find 0 results in the dropdown ajax recommendations. If they then proceed to press enter however, they will find a link to an email template that they should not be seeing. Clicking on this link will then strangely redirect to the homepage. Similar effects can be noted with the search term ‘user’, which unfortunately reveals a lot of email rules and account links in the results page.

    Please could you advise as to how to change this? I really like the results page you have bundled in this plugin but this only happens when the Instantsearch.js is selected. Choosing ‘Use Algolia in the backend’ stops this happening but I honestly much prefer your page apart from this one issue. It’s strange because the ajax results are perfect so I don’t know why the same parameters aren’t getting applied on the results page.

    Looking forward to hearing your thoughts!

    The page I need help with: [log in to see the link]

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

    (@tw2113)

    The BenchPresser

    One thing to know and understand is that the autocomplete dropdown uses a different index in Algolia than the one used for the search results. As you may have noticed, there’s an “Autocomplete” and a “Search Page” section in the plugin’s admin menu.

    Regarding some of the content, it sounds like we need to get some post types disallow-listed. I don’t know what all the post types may be for you so you’ll need to figure that part on your own. However the code example shown towards the top of this link below should help with removing them from consideration.

    https://github.com/WebDevStudios/wp-search-with-algolia/wiki/Filter-Hooks

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    @audiofoundry I’m sorry, but that is only done in extreme cases. This is not an extreme case.

    https://www.ads-software.com/support/forum-user-guide/faq/#will-you-delete-my-post-once-the-problem-is-solved

    Search engine hits are never considered extreme. The post will not be edited or deleted.

    Thread Starter audiofoundry

    (@audiofoundry)

    Hi Michael,

    I apologise for bringing this old thread back up.

    One of the custom post types I want to disallow is called viwec_template. Do I need to replace every instance of custom_post_type in the snippet with the name? Or just the second line? Would it look like:

    function mb_blacklist_viwec_template( array $blacklist ) {
        $blacklist[] = 'viwec_template';
    
        return $blacklist;
    }
    
    add_filter( 'algolia_post_types_blacklist', 'mb_blacklist_viwec_template' );

    Or is it just the second line, like

    function mb_blacklist_custom_post_type( array $blacklist ) {
        $blacklist[] = 'viwec_template';
    
        return $blacklist;
    }
    
    add_filter( 'algolia_post_types_blacklist', 'mb_blacklist_custom_post_type' );

    Thank you for any help you can offer on this.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Either one is fine, as it’s just a function name to associate with the algolia_post_types_blacklist hook.

    You could use either one and you could also add multiple post types in the one function like this:

    function mb_blacklist_custom_post_type( array $blacklist ) {
        $blacklist[] = 'viwec_template';
        $blacklist[] = 'movies';
        $blacklist[] = 'music';
        $blacklist[] = 'books';
    
        return $blacklist;
    }
    
    add_filter( 'algolia_post_types_blacklist', 'mb_blacklist_custom_post_type' );
    
    Thread Starter audiofoundry

    (@audiofoundry)

    Hi Michael,

    Thank you for your rapid reply!

    Unfortunately I can’t get this to work at all for some reason. I copied and pasted your snippet in to my child theme functions.php, and changed the terms to the names listed by the plugin ‘Find My Custom Post Types’ .

    I reindexed from the Algolia tab, then cleared cache and opened a private tab so there wouldn’t be any cookies. Frustratingly, nothing has changed and I am not sure why?

    Is there perhaps a way to do the inverse? Rather than blacklist post types that are not wanted, instead only allow Posts, Pages, and Products to display?

    My apologies for such a tedious issue here, and thanks once again for your help with this.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Was it the autocomplete settings page reindexing or the instantsearch settings page? Or perhaps both?

    One thing I noticed when I was checking on this filter is that the one in the documentation is actually listed as deprecated in the code itself (we need to update the documentation). Instead the code is preferring this filter name:

    algolia_excluded_post_types
    

    Worth trying with that one, but both should technically be working.

    No other way to skip over these that I’m aware of, as we use the filters in question to collect an array that we should skip over when indexing.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Instantsearch.js Search Results Page Revealing Backend Info’ is closed to new replies.