• Just installed the Relevanssi search plug-in and have a couple of questions.

    All the search result excerpts are just a snippet of the first lines/top paragraph of each post and page. Is it possible to show an excerpt of the place in the feature where the search result/hit is?

    I can search comments and seem to get hits but again, it’s just the top paragraph in the excerpt and not the comment. Is it possible to show an excerpt of the comment where the search result/hit is?

    Thanks for your help!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Yes. Check your Relevanssi settings (enable custom search snippets) and your search template (it needs to use the_excerpt()).

    I have a related question about using the custom search snippet:

    Relevanssi is set to search both content and excerpt, as some of my posts only have an excerpt. Relevanssi finds the posts I expect where I know the search terms are only in the excerpt (as there is no post content) but when the custom search snippet is displayed all I get is 3 dots (…).

    If the search term is found in an excerpt (and / or a custom field) can this then be included in the displayed custom search snippet??

    I have to say that I have found Relevanssi to be the best general search plugin – my only other request would be for some of the functionality of the WP Custom Fields Search plugin so I don’t have to run both. If this is planned I am more than ready to chip in a donation.

    Thread Starter riis

    (@riis)

    Still doesn’t seem to work. I’ve chosen custom search result snippets and %total% and I randomly get an excerpt with the search hit and sometimes without.

    The search.php file includes the (<?php the_excerpt(); ?>).

    I had a similar issue and most of it was solved by using:

    <?php if (function_exists('relevanssi_the_excerpt')) { relevanssi_the_excerpt(); }; ?>

    instead of just the_excerpt()

    The only time when it didn’t then highlight the term was because it was only in the post excerpt – see my post above.

    Thread Starter riis

    (@riis)

    Thanks but it didn’t seem to fix the problem.

    I’m currently using MAMP to design the site locally so I can’t show you but as I said, I get the search.php shows results with excerpts but there doesn’t seem to be any consistency whether the excerpt includes the search term or not… although the term is featured in the post/page.

    Is there a setting feature that I’ve missed? Should I adjust the boost functions?

    You’ve enabled custom search snippets and highlighting? Those should be enough to have the hits displayed in excerpts. If some excerpts work and some don’t, then I don’t know what’s wrong… Do you have any other plugins that affect excerpts?

    Can you post a screenshot?

    @cweddell, currently Relevanssi can only display post content and comment content in the excerpt. What you describe sounds bad enough to be worth fixing.

    Custom field searches… well, I have to see how complicated those Custom Fields Search features are, but maybe.

    Thread Starter riis

    (@riis)

    Here’s a screenshot.

    The search is for muff (it’s a guitar site and a muff is a pedal…). As you can see the upper excerpt doesn’t show the highlight nor the place in the text where the hit was found while the lower excerpt seems to display the hit perfectly.

    Is the “8” in the end of the first excerpt added by Relevanssi? Where the word appears in the first document?

    Thread Starter riis

    (@riis)

    Yes, the number after each excerpt is added when I choose “Show breakdown of search hits in excerpts:” with %total% value.

    The numbers seems to indicate number of hits in each post/page.

    So that means Relevanssi is processing all your excerpts and the highlighting doesn’t work for some reason. That’s why I was asking where the matches appear in the first document.

    Hello,

    I was having trouble getting the post highlighting to work in excerpts as well, also it wouldn’t alter the excerpts even though I was using the_excerpt() and had the correct settings in the admin area – I found it can be made to work by removing a custom query, I had the following:

    <?php
    	$args = array(
    	        'post_type'=> 'vacancies',
    	                's'    => $s);
    	        query_posts($args); ?>

    Hopefully that may help someone else or maybe there can be a fix for such a query?

    Kind regards

    Jon

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Relevanssi search result excerpt’ is closed to new replies.