Skip to main contentSkip to footer

I was told that Relevanssi Premium doesn’t index drafts, even though it should (since 1.6). Looks like the feature has gone missing in some update. Sorry about that. This version reintroduces it. Drafts are automatically indexed and shown in admin searches.

I’m also adding the first test version of the declension featured mentioned before. This first version is a simple suffix stripper in English and it removes the following suffixes from words when indexing and searching: -s, -en, -ed, -er, -ly, -ing and -est.

There’s no option to enable the feature. To enable it, add the following line of code in your functions.php:

add_filter( 'relevanssi_stemmer', 'relevanssi_simple_english_stemmer' );

After that, re-index the database.

I’m curious to hear how this works for you. The Relevanssi options page shows the number of rows in the Relevanssi database now – one thing I’m interested in is to know how many rows enabling the stemmer removed from the database. So, give it a go, and tell me what you think of it. Finer controls and other languages will follow.

Your account

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

Search

Popular Resources

Unyson

…cover most of the indexed content. It gets text elements added in the posts and text elements inside other elements (like columns). The title element gets headings, text gets all the text box contents. Of course, it’s also possible to modify this function to capture more content or deeper hierarchies….…custom field should only * appear once, so we just take $value[0]. */ $content = json_decode( $value[0] ); $string = ”; foreach ( $content as $section ) { if ( isset( $section->atts->title ) ) { $string .= $section->atts->title; } if ( isset( $section->atts->text ) ) { $string .= $section->atts->text; }……if ( isset( $section->_items ) ) { foreach ( $section->_items as $item ) { if ( isset( $item->_items ) ) { foreach ( $item->_items as $child_item ) { if ( isset( $child_item->atts->title ) ) { $string .= $child_item->atts->title; } if ( isset( $child_item->atts->text ) ) { $string .= $child_item->atts->text; }…

Category title in the search results page

If you’re using category restriction dropdown on your search form, here’s a bit of code that you can add to your search results template to show how many hits were found and what the category is. If no category was selected, this’ll just show how many hits were found. <?php…

Gutenberg Full Site Editing

…excerpts are passed through wp_trim_words() which removes HTML tags. This function can be used to overcome this limitation: add_filter( ‘wp_trim_words’, function( $text, $num_words, $more, $original_text ) { global $post; if ( isset( $post->relevance_score ) ) { return $post->post_excerpt; } return $text; }, 10, 4 ); If the post has the……$more, $original_text ) { global $post; if ( ! empty( $text ) && isset( $post->relevance_score ) ) { return $post->post_excerpt; } return $text; }, 10, 4 ); Restrictions Relevanssi cannot add the highlight parameter to the permalinks in FSE themes. This means you cannot use the “Highlight in documents” feature….…relevance_score attribute set – which should only happen within a search context – this function will cause the wp_trim_words() to return the original post excerpt. With Max Mega Menu, the function above will add the excerpts to the menu items. You can avoid that: add_filter( ‘wp_trim_words’, function( $text, $num_words, $more,…

Related Posts:

Comment Section:

2 Comments. Leave new

  • At this time everything looks ok, i just hope will be in one year or two some updates to support a large number of articles.

    Reply
  • For custom post types, searching them in the admin system fails because posts_per_page might not be set or it’s -1. The problem is that the search high is lower than search low. As such, no search results are returned.

    My quick fix in relevanssi.php at line 953 is the following. Of course, I’m going to fix my custom post type definitions as well.

    if ( $query->query_vars[“posts_per_page”] query_vars[“posts_per_page”] = 20;
    }

    Cheers for an awesome plugin.

    Michael

    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