Skip to main contentSkip to footer

The easiest way to debug indexing problems is to use the WP CLI tools available in Relevanssi Premium. To see how Relevanssi sees the post 123, just use the following command on the command line:

wp relevanssi index --post=123 --index_debug=true

This will print out how Relevanssi sees the post, how it appears in the different steps of the indexing process and the database queries Relevanssi uses to save the post data.

If WP CLI is not available or you are using free Relevanssi, this’ll do pretty much the same thing:

add_action( 'wp', function() {
 if (is_user_logged_in()) {
  relevanssi_index_doc( 123, false, relevanssi_get_custom_fields(), true, true );
  exit();
 }
});

Add this snippet to your theme functions.php file and change 123 to the ID number of the post you want to inspect. Then go visit any page on the front-end of your site. Once you’re done, remove the code.

Your account

Not logged in. Log in to see your license details.

Search

Popular Resources

Natural-language date queries

…= date( ‘d’, $time ); $date_query = array( ‘month’ => $month, ‘day’ => $day, ); if ( $use_year ) { $date_query[‘year’] = $year; } $query->set( ‘date_query’, $date_query ); $query->query_vars[‘s’] = ”; } return $query; } The solution is simple. The search query ($query->query_vars[‘s’]) is fed to PHP’s strtotime() function, which…I just wanted to be able to type in a date on the search and for the search to come up with all the blog posts for that date. This is one of those tasks that sounds really simple, but is actually complicated. However, this question piqued my interest and……converts an English-language string to a timestamp. If the search query converts to a timestamp, the timestamp is converted into a date and used for a date query. The function also checks if the year appears in the query. If it doesn’t, the year isn’t used. Yearless dates are converted…

Genesis

…Relevanssi permalink add_action( ‘genesis_entry_content’, ‘child_do_post_excerpt’, 1 ); function child_do_post_excerpt() { if (is_search()) { remove_all_actions( ‘genesis_entry_content’ ); // Get featured image if page or post the_post_thumbnail( ‘medium’, array( ‘class’ => ‘alignright’ ) ); // Uncomment the following lines to get featured image if WooCommerce product category – this doesn’t work if……Genesis make small changes like these more complicated. Sarah Moyer took the effort to figure out how to make the necessary changes in Genesis. First, in order to get the correct permalink in the post title, add this code to your site: // Modify content to add Featured Images and……( function_exists( ‘relevanssi_get_permalink’ ) ) { echo ‘<a class=”read-more-link” href=”‘ . esc_url( relevanssi_get_permalink() ) . ‘”>View more »</a>’; } } } Then, for excerpts: // Modify content to add Featured Images and Relevanssi permalink add_action( ‘genesis_entry_content’, ‘child_do_post_excerpt’, 1 ); function child_do_post_excerpt() { if ( is_search() ) { remove_all_actions( ‘genesis_entry_content’ );…

Related Posts:

Comment Section:

2 Comments. Leave new

  • Hi,

    I’m using Woodmart theme for my store. When I use Woodmart AJAX search only it index the product page contents including product descriptions but product attributes and categories.

    When I add Relevanssi, it index all the attributes, categories but product content such as descriptions.

    How can I index product page content such as short description, product description along with attributes and categories using Relavanssi.

    Regards

    Reply
    • Product description is stored in the excerpt, so make Relevanssi index the excerpt. Product attributes and categories are taxonomies, so make Relevanssi index all those, too. Product description is just post content, which is always included.

      The Woodmart AJAX search doesn’t use Relevanssi. You can try this snippet in your theme functions.php to help with that:

      add_filter( 'woodmart_ajax_search_args', 'rlv_enable_relevanssi' );
      function rlv_enable_relevanssi( $args ) {
      $args['relevanssi'] = true;
      return $args;
      }

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed