• Resolved nowton

    (@nowton)


    I used this documentation literally on my client’s site but still the affected pages show up in results. Try “formulier” and see results mentioning “Tripetto”. I’ve cleared caching and used Re-indexing and Pushing Settings. What could be causing this?

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

    (@tw2113)

    The BenchPresser

    Just to be extra sure, you also added this snippet of code below to your active theme or custom plugin to make sure these items don’t get indexed going further, correct?

    Also, did you make sure to visit the “Autocomplete” section of the settings, at /wp-admin/admin.php?page=algolia (add your own domain to this), and use the re-index buttons there for the individual content types? Autocomplete is stored in different indexes than the “Search page” re-index button.

    // functions.php
    function wds_algolia_exclude_post( $should_index, WP_Post $post ) {
     
      // If a page has been marked not searchable
      // by some other means, don't index the post.
      if ( false === $should_index ) {
         return false;
      }
    
      // ACF Field.
      // Check if a page is searchable.
      $excluded = get_field( 'exclude_from_search', $post->ID );
     
      // If not, don't index the post.
      if ( 1 === $excluded ) {
         return false;
      }
     
      // If all else fails, index the post.
      return true;
    }
    add_filter( 'algolia_should_index_searchable_post', 'wds_algolia_exclude_post', 10, 2 );
    add_filter( 'algolia_should_index_post', 'wds_algolia_exclude_post', 10, 2 );
    
    Thread Starter nowton

    (@nowton)

    Yes, code was copied verbatim and everything was reindexed but the results still show up.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Best I can offer at the moment is logging in to your Algolia dashboard and checking your indexes directly, to see if they’re matching what you’re expecting and if the results coming in are still indexed there or not.

    If they’re still present in your algolia dashboard, then the refreshes and index removing is failing at some point along the way.

    Thread Starter nowton

    (@nowton)

    I see the records are still there in Algolia and will delete them. This site isn’t updated that often so we’ll see if they turn up after updating next time.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Sounds good. Worth trying just updating one or two posts to see if they helps, which should also re-index those individual items. Even just changing punctuation somewhere would be enough.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Excluded posts still show up in results’ is closed to new replies.