Support » Plugin: Search by Algolia – Instant & Relevant results » Search results from one page only

  • Resolved Rui Cruz

    (@ruicruzpt)


    Hello,

    Is there a way to make this plugin search only a unique page of an entire site? I want also the search form only on that specific page but I think that I can do easly.

    Thank you,
    R.

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

    (@rayrutjes)

    Hi Rui,

    You can indeed make the plugin index only one page. For that though you will have to index only the ‘pages’ on the indexing screen but also filter the indexing to only index that one page like explained here: https://community.algolia.com/wordpress/indexing-flow.html#indexing-decision

    I hope that helps!

    Hi rayrutjes ,

    Thanks for your quick reply.

    The tags at blue on the article I’ll assume they’re costum post types, right?

    If so, I have to add to ALL page the excluded_from_search = true to index just one page, or I am missing anything? Since I have 70+ pages, that would be painfull.

    Instead, can I restrict the content searchable by user “X”, and create a user just for that post, or I’m going the wrong way here?

    Thank you again for your reply.

    R.

    Plugin Contributor rayrutjes

    (@rayrutjes)

    Here is a quick example:

    <?php
    /**
     * @param bool    $should_index
     * @param WP_Post $post
     *
     * @return bool
     */
    function filter_posts( $should_index, WP_Post $post ) {
        $page_id_to_index = 33;
    
        return $post->ID !== $page_id_to_index;
    }
    
    add_filter( 'algolia_should_index_post', 'filter_posts', 10, 2 );

    You need to replace ’33’ with the ID of your page that you want to index.

    Best.

    I have a similar need.
    I want to use Algolia to index and search a specific data set/page view on the site.
    Eg The list of vet practices in New Zealand.
    But then I also want to use Algolia for a site wide search when using the search bar up in the top nav bar.
    Can you have it return two different sets of search results within the same site?

    Plugin Contributor rayrutjes

    (@rayrutjes)

    Hi there,

    By default we provide a dropdown autocomplete feature and a search results page.

    The results for each of those can be different, so you would be limited to 2 different search experiences.

    Please note that we are considering bringing more tools to the community to make sure you can build custom search experiences without any limitations. That would need some developer power on your side though to do the frontend integration. How does that sound?

    Best,

    That sounds perfectly reasonable 🙂
    We’d be happy to hire someone.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    That sounds good but this topic is being closed now. Talk of hiring isn’t for these forums.

    https://make.wordpress.org/support/handbook/forum-welcome/#do-not-offer-to-pay-for-help

    If you like you can post a listing on http://jobs.wordpress.net/ or contact the author on his site if he’s posted that link on his plugin page.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Search results from one page only’ is closed to new replies.