Relevanssi stores the relevance score it uses to sort results in the $post variable. Just add something like
<?php echo "Score: $post->relevance_score"; ?>
to your search results template to display the relevance score.
Related Posts
Relevanssi Live Ajax Search
...accessibility. A basic search form looks something like this: <form role="search" method="get" class="search-form" action="/"> <label> <span class="screen-reader-text">Search for:</span> <input type="search" class="search-field" placeholder="Search …" name="s"> </label> <input type="submit" class="search-submit" value="Search"> </form> With Live Ajax Search, the form should look like this: <form role="search" method="get" class="search-form" action="/"> <label> <span class="screen-reader-text">Search for:</span> <input......type="search" class="search-field" placeholder="Search …" name="s" data-rlvlive="true" data-rlvparentel="#rlvlive" data-rlvconfig="default"> </label> <input type="submit" class="search-submit" value="Search"> <div id="rlvlive"></div> </form> Search results templates The Live Ajax Search plugin uses templates to display the search results. Using templates means it is easy to override the default search results from your theme if you want to......} ); Changes from SearchWP Live Ajax Search Relevanssi Live Ajax Search is a fork of SearchWP Live Ajax Search. I forked it from version 1.6.1 because it looked like SearchWP Live Ajax Search wasn’t getting updates anymore. I also wanted to improve the Relevanssi compatibility. Relevanssi Live Ajax Search...
Related Posts
...Relevanssi uses a simple CSS grid to lay out the related posts. This setting determines the minimum width of each element. Experiment with different values to see what works. If you want to style the related posts, Relevanssi wraps everything inside div#relevanssi_related, the header is in div.relevanssi_related_grid_header, and the grid......itself is in div#relevanssi_related_grid. Each post is a div.relevanssi_related_post. If you want to make more extensive modifications, you can create your template. Relevanssi will look for the relevanssi-related.php template inside the current theme templates directory, and if it finds one, it will use that instead of the default template. When......<li class="relevanssi_related_post"> <a href="<?php echo get_permalink( $related_post_id ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>"> <?php echo get_the_title( $related_post_id ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> </a> </li> <?php } ); ?> </ul> </div> <?php endif; Single post settings There are also Related posts controls on post edit pages. You can disable the auto-append for...
Installing Relevanssi and adjusting the settings
...words to the search query and in OR search that works as expected, widening the search. In AND search, it will restrict the search, so it won’t work. Enabling this option will make Relevanssi index the synonyms as part of the post content, making them compatible with AND searches. Index......operator OR search will return all posts where at least one of the search terms appears. AND search will only return posts that have all search terms in them. OR search will prefer posts that have all search terms in them, so in most cases it is the better option.......all on all search forms on the site. If a search form includes the searchblogs parameter, it will override this setting. You still need to modify the search results template to get working permalinks, this (and the next) setting is just a shortcut for setting the searchblogs parameter. Search some...
Premium 2.15 / Free 4.13
...relevanssi_search_url_prefix to adjust the prefix in case it’s not /search/. Spam blocking is also extended to page views with spam content in the highlight parameter. Premium: The MySQL column detail information has been missing from the index. Adds support for Avada Live Search. Adds support for Fibo Search. The filter......searching. Minor fixes Premium: Attachments that cause the reading server run out of memory are now labeled with the “File size too large error”. Premium: Multisite searches were not logged. Now they are. Warnings when creating excerpts with search terms that contain a slash were removed. Better Ninja Tables compatibility...These versions add lots of new features. Premium users get a spam block feature that will help you prevent spam queries, there’s a new Google-style “missing words” feature in OR searches that shows which words are not included in each result. Multisite searching has been refactored and improved a lot,...
Multisite searches
...other hand, you can adjust the settings for each blog. Enabling the multisite search There are several ways to enable multisite searching. If you want all searches to be multisite searches, you can enable multisite searching from the Relevanssi searching settings. If you want only some searches to be multisite......searches, you need to adjust search forms to include a specific parameter that will enable the multisite searching. See “Changes to the search form” below. Changes to search results templates The search results templates require some changes, otherwise, the permalinks will be wrong. Inside the while (have_posts()) loop, add as......in the same WordPress network, use the searchblogs argument. You can add a hidden input field in the search form, for example. List the desired blog ids as the value. For example, searchblogs=1,2,3 would search blogs 1, 2, and 3. Here’s an example search form: <form action="https://www.relevanssi.com/" method="get"> <input id="s" name="s"...
Premium 2.16 / Free 4.14
Relevanssi Premium 2.16.0 is a major release that adds new, exciting features. The most interesting new tool is click tracking, which grants you extra insight into what the search users are doing. Som...
What if $post->relevance_score is blank or does not exist?
var_dump($post) does not show that field
any ideas?
Yes: are you sure Relevanssi is active? Because if Relevanssi processes posts, that field will be there.
We’re testing this plugin for use on our site and seems to be working great. HOWEVER. we’ve tested the results and it seems that if the search term is matched in the content 1 or 1000 times it still ranks it with the same weight?
if this is the case how can we change this so that it would rank a page higher if it has 5 hits for that term over 1?
We’re only really searching on page title and content, we’re not using tags or categories, so we really need to use the number of times the search term is in the content to help pull more relevant results up the results page.
thanks in advance.
`Scratch that. Seems to be working as i want it to. great stuff.