When you have problems with Relevanssi, these are the first steps to take:
- Make sure you have the latest version of Relevanssi. If not, upgrade.
- Try deactivating the plugin and reactivating it.
- Are you using Yoast Local SEO? Read this.
- Try deleting the plugin and reinstalling it from scratch.
If that doesn’t help, then approximately 90% of the time the problem is the same: there’s a query_posts()
call on the search results page.
Any calls to query_posts() on search results template make Relevanssi fail silently. You’re not getting results from Relevanssi any more. This is unpleasant, but something I can’t really fix, considering that WordPress doesn’t offer any official way to replace search results and the way Relevanssi is coupled with WordPress is something of a hack. So, something simple like this can throw Relevanssi off.
If you’re having problems with Relevanssi, the first step is to check your search results page, usually search.php. See if there’s a call to query_posts() and if there is, comment it out. In most cases that is enough to fix the problem.
It’s not always query_posts()
. Appearance of new WP_Query()
is another sign of trouble, or $wp_query->get_posts();
. Anything that queries the database for new posts is trouble for Relevanssi.
If you need help, you can post on the Relevanssi support forum. Please include the contents of your search results template, put it in a pastebin and share the link.
hi
using relevansi the results are really crapy
no header
no ordering
no listing…
any idea?
thx
g
So, did you check if there’s a query_posts call on your search results page?
Hi, same issue, can you give me the code I’ll need to place on my search page template? Thanks!
Hi, I got into some problems with the Twenty Eleven theme, when I activate Relevanssi I cannot read much in the search result page. In fact it crashes in a strange way.
There is no such call to query_posts, of course. More tips for troubleshooting would be welcome…
My mistake. I was messing up with searchblogs in a wrong way (empty value). Maybe is a good idea to sanitize this value if empty…
Mikko, I notice you’ve been furiously updating Relevanssi Premium. Still, if I put admin in the exclusion box, admin searches are all that’s logged. With nothing in the box, it logs all searchers, including of course admin.
Oh, sorry. I’ve forgot about that… I’ll add it to my new bug tracking list right away, and I’ll be sure to check it out the next time I’m working at the plugin.
Hi Mikko– you’re working hard on updates. Here’s the status of my problem: I login as wpadmin. If I exclude that (or even wp) from the search, it logs my searches, yet no other users’.
I excluded only “juju” and it logged both my searches and others’. So exclusion works with non-administrative entries.
I hope this can be solved. Thanks, Philip
You need to use user id, not user name. Looks like a documentation problem…
Hi Mikko– I have tried all combinations of user id and password…using id first as name and then as password. No combination works. I don’t think I have registered before, so I clicked register. That always brought me back to this page…no place to register.
And search exclusion of administrator doesn’t work…even with your latest update.
Help! Philip
Have you tried using numeric user id in the log exclusion?
Yes. I excluded my user id and it logged both admin and all other searches. I even tried excluding just the numeric part of my id with the same results.
Mikko– I’m getting an update to Premium Relevanssi almost every other day. Are you really making all these changes?
There are no updates, it’s just the buggy update API that says so. No need to update, unless the version number changes.
Fuzzy matching not working. I only want to search ‘whole’ words. Why is it so difficult to find a plugin or hack to do that? I don’t want anything else, only whole words.
Disable fuzzy matching, and Relevanssi will match only whole words. It’s simple as that. If you use highlighting, that may be a bit deceptive, as the highlighting will highlight partial words – that’s not what Relevanssi matches, it’s just the highlighting.
I’m using a MySiteMyWay theme and they have a whole framework it’s built on so finding the query_posts() call is really hard (it’s in lib/functions/theme.php, line 1449 for me, but I don’t want to make framework changes). So I added a wp_reset_query(); call in search.php. It now looks like:
No idea whether this is going to cause cancer or have other side-effects, but it worked out well for me!
For some reason, searches stopped returning results. It had been working fine, now nothing. Even rebuilding the index doesn’t work. No query_posts(). Any suggestions for debugging? The log shows lots of successful searches in the past, but now nothing.
PS — The index appears to be good:
State of the Index
Documents in the index: 2049
Terms in the index: 89133
Highest post ID indexed: 13352
Just nothing on search results page.
I get the same issue as Bob. Lately I updated WP to 3.4.1 and twenty ten to 1.4 (I am using a child theme of twenty ten).
I think we solved Bob’s problem, but I don’t remember how… I’ll have to see if I can find out how.
I’d love to hear how Bob’s issue gets resolved as well, since I’m seeing the same thing. It used to work a few weeks ago, yet now it doesn’t provide any results.
If I disable the plugin and search the same terms, it provides tons of results.
Re-enabling and re-indexing doesn’t change the no results issue.
I also made sure there was no query_posts in the search.php document.
Which version are you running, David?
I’m running Relevanssi 3.0.3 for the fist time on WP 3.3.2 and I’m getting the “No posts yet !” message. Index built successfully.
I’ve commented out the query_posts in my search.php.
I’ve deactivated and reactivated several times.
Still no search results. Do you remember how you helped Bob?
I think the problem might still be in your search results template somehow.
I have an issue with the title boost and no query_posts() call on my page. The titles of my posts, pages and custom post types doesn’t seem to get the needed relevance, even if I have set the boost to 5 in the Relevanssi-backend. I want the search results that way, that if the title matches, the post/page is on top of the results. How to do that?
Well, for starters, 5 is not much – set the boost to 50 or 100 and see if that helps.
Hi – I’m using WordPress 3.4.1 and Relevanessi Version 3.0.1. I think I’ve used the plugin for over a year or two with no problems. Now, some time reasonably recently (last few weeks?) it’s stopped working (just get a “no results” message when searching). I’ve double-checked for the presence of query_posts() but it’s not there. I notice a couple of other people here have what might be the same problem.
It was probably the update. Try to deactivate and reactivate the plugin to see if that helps.
Ah – that seems to have done it (also re-built the index too – don’t know if that helped). Thanks.
Hi, ever since the 3.0.2 upgrade my search results have odd code at the end. It’s probably because I’m also using the GD Star Rating plugin. But the previous version of Relevanssi didn’t do this. Here’s a sample:
This is Victoria just west of Beacon Hill Park from 1954. You can still make out the Empress Hotel and the Parliament Buildings off in the distance. UA:F [1.9.20_1166]please wait…Rating: 0.0/5 (0 votes cast)…
Yeah, probably something with GD Star Rating. Don’t know what, though…
Hi,
Can you please let me know what needs to be done to make the plugin working with optimizepress? It is not showing any search results after indexing pages
Thanks much,
No idea, I’m not familiar with the theme. Did you read this post, about the query_posts() stuff? That’s your best bet.
Hi Mikko,
Yes, just after submitting the comment I could make it work. Thanks so much 🙂
Hi Mikko,
I really like your plugin. There is one thing I can’t seem to fix:
I want to show custom excerpts of “pages” including a custom read more link.
—
Framework:
Roots: http://www.rootstheme.com/
—
For enabling page excerpts I used:
http://wordpress.mfields.org/2010/excerpts-for-pages-in-wordpress-3-0/
—
For enabling custom read more links I used:
http://codex.wordpress.org/Function_Reference/the_excerpt
code used:
function new_excerpt_more($more) {
global $post;
return ‘ID) . ‘”>Read the Rest…‘;
}
add_filter(‘excerpt_more’, ‘new_excerpt_more’);
—
In the plugin:
– Create custom search result snippets: enabled
– Allowable tags in excerpts: -blanc-
—
Somehow I’m not seeing it and I’ve maxed out my daily coffee intake so if you are able to help me fix it or point me in the right direction that would be awesome.
oh and no query post shizzle going on.
Regards,
Toni
Yeah, looks like the excerpt_more filter doesn’t work. Here’s a workaround I found in Twenty Ten:
The test is read.
First part works!
Thanks for the quick reply
Up to styling now.
One point:
It still displays the first few lines of the page instead of the custom excerpt.
How do I hook into my custom Excerpt? Or is the above code for enabling excerpts on pages not accurate anymore?
Regards,
If your theme is using the_excerpt() on search results pages, Relevanssi should take over the excerpt, and it doesn’t matter if you have the excerpts enabled for pages or not.
Are there any other functions besides query_posts() that may be preventing Relevanssi results from appearing?
No, there shouldn’t be.
Mikko,
It appears for us (using HTML5 Reset Framework), we are seeing the index build, but we are not getting results for custom content types (using Custom Content Type Manager) and custom fields (specifically relation type fields).
Some of the content is found in the index table but does not show as a result. We should note that the terms are being picked up and indexed for the entire custom post type, just not found as a result.
Is there a way we can extend the indexing or results to show this?
Thanks!
Bill, if you’re a registered user, please use the support form to send me more details. Which version are you using? What are those content types? Are they post types, or something else?
Hi Mikko,
I love Relevanssi and thank you for all the hard work. I’ve got a problem that I’ve just noticed recently, one that persists even if I turn off Relevanssi, but I’m still hoping you might be able to help me zero in on the fix:
Some search results to pages and posts are suddenly missing links to the source. For example, look at this page: http://www.aur.edu/american-university-rome/?s=accu&submit=Search
Notice the first two results don’t have links, but the third that includes the h2 title does and the next one with the h2 title and featured image does.
Any idea as to why this is happening?
Yes, I have checked my “search.php” for query_post call and I’m clean. Any and all insight you can provide would be greatly appreciated.
Cheers,
Tim
Tim, problem is in your style sheet. All those results have h2 titles, but your style sheet sets .page-title to “display: none”, which means they don’t show up. The post meta and bylines appear on those two results, because those two are posts and the other are pages. The answer to that problem lies in your search results template.
Mikko,
You are a superstar. How did you find that? Now I will try and fix it…
Thank you so much!
Tim
Took a look at your site using the “Inspect element” feature of Google Chrome. It’s the best tool for a web designer. For Firefox, you can use Firebug, and other browsers have similar features.
Fixed!!! I changed the CSS to h1.page-title to display none… and now the h2’s appear in the search.
Yes, I use the equivalent tool in Safari, but I overlooked what you clearly saw.
Thank you again so very much, Mikko!
Cheers,
Tim
Results don’t change. No query_post call in search.php. Any suggestions?
Searches are being logged.
Hi Mikko – I installed your plug-in and then get no results. There does not appear to be a query_post() call in the search php. I must be doing something wrong but I cannot figure it out. Your plug-in is disabled on the site right now. Thanks for any help you can give.
Which version you have? Is the “Limit searches” option enabled, but the “Limit” option empty?
The latest version and I had limit searches enabled and the limit set to 500. Let me try it without that limit.
Here’s what I have – any help would be forever appreciated!
News Topics
<div >
<h3 id="post-“><a href="” rel=”bookmark” title=”Permanent Link to “>
<?php the_tags('Tags: ', ', ', '’); ?>
Posted in
|
No posts found. Try a different search?
Kurt, send me the search template to mikko @ relevanssi.com or post it to a pastebin somewhere, as the comment system mangles the code.
Hi there. I’d like to first say, great plugin! It’s made our search a lot more useful, and is very simple to use.
I am having one problem-whenever the search string is wrapped in quotes (e.g., “foo bar”) the page dies, but wordpress doesn’t throw any fatal errors. I am using query_posts() (but in the sidebar, not the search result section), but commenting them out didn’t help.
Any ideas?
Ken, like my previous comment says – send me the code to mikko @ relevanssi.com or post it to a pastebin, so I can take a look at it.
Hello, I installed this plug-in and set the right settings. But I’m stuck now. How do I add the searchoption so this is visible on a page or in the widgetarea? my site is in dutch
If it works good im getting the premium version.
Just use the default WordPress search widget, Gio.
So this may be a dumb question, but I’ve installed the plugin. Is there a RelevanSSI Search widget or something like that that I can use in the sidebar? Thanks!
Just use the default WordPress search widget, Ben.
New WEB site soon to be launched. I must say that this is by far the best search engine for sites that I have ever seen. But, I have a small problem. Our site is all about “Wi-Fi” so people will search for this term. Problem is that relevanssi interpret this as a Boolean NOT searching for all pages containing Wi but not Fi, no pages will be found in searches…….
I there any way to:
A. Have a “include” word saying boolean NOT should not be used for th term Wi-Fi.
OR
B. Disable the boolean NOT feature
A bonus question:
People may use wifi, WiFi, Wi-Fi when searching, but my site use Wi-Fi, is there any way to define alternative words that should be tied to the indexed Wi-Fi term? So searching for wifi will include results containg Wi-Fi?
Thanks in advance!
First of all, if you’re running the free version of Relevanssi (I assume so, as you’re not using the customer support form to contact me), there simply isn’t a boolean NOT operator in Relevanssi.
What you’re seeing is punctuation removal, which replaces the dash with a space, resulting in “wi fi”, which is then not searched, as the minimum word length for indexing is 3 by default.
Relevanssi is case insensitive, so that doesn’t matter. There’s the synonym feature which you can use to support alternative spellings, but what I suggest here is a simple function:
add_filter(‘relevanssi_remove_punctuation’, ‘fix_wifi’, 9);
function fix_wifi($str) {
$str = str_replace(‘wi-fi’, ‘wifi’, strtolower($str));
return $str;
}
After you add this to functions.php of your theme, reindex. Now every occasion of wi-fi, in posts and search queries, will be normalized to wifi. Problem solved.
Thank you Mikko!
Hey Mikko,
i’ve a similiar Problem and could not get any result while looking for “R.O.O.M”, what is a post_title.
I tried setting ‘relevanssi_min_word_length’ to 1, but it doesn’t work.
Then I tried to use your synomys feature and defined ‘room = R.O.O.M.’, ‘ROOM = R.O.O.M.’ and it also returned zero results.
My last try was using your “fix_wifi” filter function from the comment above. I modified it to str_replace(‘r.o.o.m.’, ‘room’, strtolower($str)) but at all nothing worked.
I hope you could point me into the right drection.
Regards Carsten
We have a strange problem with Relevanssi. We made the index without problems, but on the site we have no results, but we can see hits in the Relevanssi User Searches. The admin searches works fine,, but no results on the side.
So far as well. We have a Developer Environment, where we use exactly the same Software and there it works fine. We make a svn checkout on our productivity server, so it is exactly the same software, but it does not work outside.
I changed the theme outside but i got no results. I interchange the DB, but it only work in the developer Environment.
So we supposed that it is a spooky php fenomen. But there is nothing in the error.log
Perhaps you have any suggestion?
Dirk, last time someone had a problem like this, it was caused by a subtle difference in either Apache or PHP configuration between the development and production environments.
Thank you Mikko, you got a hint what it could be. I compared the php.info and did not find anything suspect.
Last time the problem was caused by PCRE settings, I found the post in my archives.
OK, I Found the source of defect. It was a different Theme of WPTouch Pro, which is a Plugin for Mobile Devices. I could not imagine that this has influence also to the Webtheme, but it could.
We are having the same problem with Relevanssi not working with WPTouch Pro – not showing results
using any theme that came with it – how did you solve this problem?
The Classic-Theme work for us and I could make a Childtheme from that as well. Do you make any Searchmanipulation in the root-functions.php?
we made no modifications to search and none to the themes and none to the plugin code. What weird is that it shows that there are a number of results, but the actual page says no results found, directly below where it says the search returned x number of results. So I’ll do a search and get a page where at the top it says I have 29 results in the header area, and below that the search results page itself says there were no items in my search. you can see this at http://www.ablogtowatch(dot)com on the smartphone
This is not the same Problem I had. My Search did not work for both: Mobile and Desktop. I had made Category Exclusion for the Search in the Mobiletheme and for that relevansi did not work. But I was surprised that the Mobiletheme from WPTouch Pro effect also my Desktoptheme (Thematic).
Your Desktop search works. So I think you have to modify the root-funktons.php to add the search result. Does your Mobile search work without relevansi?
mobile search does work without relevanssi – I think I have to find another solution because we need mobile to work
Probably 3 years too late, but the reason is that search.php in the WPtouch theme uses a custom query. Instead you can use the code from index.php as a base which just loops through the default query.
Im having a similar issue. It worked when i downloaded and tested it but just recently i see no results on the search page, only hits in the user search logs. I tried everything above, and an upgrade of the plugin but still no results show.
Hard to say what’s wrong. Which version did you download, and to which version did you upgrade?
I can exactly remember the original version, i think 3.0.1 i have since upgraed to Version 3.1.3. Both versions were not displaying results. wordpress version 3.4 I understand you can only guess at this point, so any pointers or PHP settings you know of would be great, thanks!
I’d start by looking at a var_dump($wp_query); on the search results page to see if there’s anything unusual there, then I would drop var_dump() calls in Relevanssi search functions (relevanssi_search() in lib/search.php) to see where in the process the results go missing.
Actually, start in relevanssi_query() (also in lib/search.php) – does it return the search results in $posts variable or not?
when i ran var_dump($wp_query); on the search results page it returned nothing, but when i do var_dump($wp_query); inside the relevanssi_query() function it returns matching results in an the array. so it is finding the results just not displaying theme, could be a theme issue i guess based on that.
Some online shop site I fixed – I’m not sure if it was WP-eCommerce or some other plugin – had a search form that by default excluded products from the search.
Add this to your search results page: global $wp_query; var_dump($wp_query->query_vars[‘post_type’]);
global $wp_query; var_dump($wp_query->query_vars[‘post_type’]);
returned blank… im pretty stumped on this as i have not updated anything or even installed new plugins that would cause this conflict.
It would help a lot if I could take a look at your site. But check your search form or eCommerce plugin settings to see if the search is not excluding post types.
Mikko,
I appreciate your support, especially since it was free and you did it in your spare time. However i have since purchased a plugin specifically for wp-ecommerce product search. Thanks again!
I get no results from relevanssi after I upgraded to the latest version. even when I disable the plugin I get no results in the search page. Anything I should be checking? I’m using this plugin with jigoshop to search products. the post type is “product” and I checked it in the settings page to be indexed.
Is your search set to search products? Check both your search form and the Jigoshop settings.
Hi,
first of all I’m a foodblogger from Germany and not a developper. I was using Relenavanssi succesfully during the past month but now I get an “error 404 page not found” after entering a search criteria. How can a dummie like solve that problem?
I’m using 3.1.3.
thanks so much.
Claudia
a dummie like me, that’s what I wanted to say.. 🙂
Your search form has an error. It comes up with a URL like this: http://www.example.com/suchen/?s=speck&submit=Suchen when http://www.example.com/?s=speck&submit=Suchen would work.
Your searchform has:
<form id=”searchform” action=”?php bloginfo(‘url’); ?” method=”get”>
when it should have:
<form id=”searchform” action=”<?php bloginfo(‘url’); ?>” method=”get”>
thanks so much for the hint. I have changed the code, but it did not do the trick…. any other ideas?
You copied the code incorrectly. Make sure the code looks exactly like I posted it. It doesn’t, right now. Do not use copy-paste, but write it yourself. Make it look exactly like in my example.
thank you so much for your kind support. I did not copy the code – I typed it. Still it does not return any results. It says that possibly the page has moved. Could it be that somewhere in the function bloginfo(‘url’) there is an invalid path? could it be that I have to change it somewhere on the DB? or in one of the files?
No, the code is wrong. I can’t write the code here, because the comment form mangles it, but it starts (ampersand)lt;?php when it should have (less-than-sign)?php. In the end there’s (ampersand)gt; where a greater-than sign should be. If you’ve written less-than signs and greater-than signs instead of the codes, then you’re using an editor that cannot be used to modify HTML code, and you need an editor that doesn’t ruin PHP code.
51584012240167772151
9
6
1036
93
FontSize=10000;FName=Arial;Kursiv=0;ULine=0;SThru=0;ForeColor=0;BackC=16777215;TextColor=0;Align=0;BW=1;BS=0;BA=2;BST=2;NOPRINT=0;ArrowType=0;UIDEFMODE=0;;IsLinkValue=0;UseUnique=-1;NLines=1;NChars=30;;;
*DBField
7
2864
000000000VICT_DBA14F102C13E41B8F
that is what I copied from the search form
sorry please delete previous post. copied the wrong text
Claudia
WP 3.5.1, 18 posts, 48 pages
First ever Relevanssi install, all settings default
I have indexed
I looked through search.php and loop.php and did not find query_posts()
Problem:
Page title ‘About Us’ with permalink /about cannot be found by searching ‘about’, ‘about us’, etc.
Possible issue:
The server is IIS7, with .htaccess fix for permalinks. – yeah, it’s bad but I can’t change it
Thoughts?
“About” might be a stopword. Check the stopword list. I don’t think it’s a huge problem – who searches for “about us” page of a site, with those words? I don’t think many people do.
It’s not too big a site so removing the stopwords ‘about’ and ‘us’ shouldn’t be a problem. And, so far, it looks like we’re in great shape. You have another follower, thanks!
Hello,
I´ve running relevanssi for last 4-6 months.
Everything seems to be OK. Plugin was updated two-three times without any problem.
But I´ve just updated to version 3.14 and Relevanssi doesn´t work: when searching nothing is found.
I´ve rebuild the index and deactivate-activate the plugin but problem remains.
When deactivating elevanssi standard WP search works OK.
I´m running WP 3.5.1
Any suggestion how to fix the problem?
Thanks!
Which version did you update from?
I´m not completely sure but since I use to update plugins asap I guess I was running 3.1.3.
In that case it’s hard to say – might be a conflict with your other plugins.
Have you got a list of plugins with known conflicts with Relevanssi?
Thank a lot!
No, I don’t have a ready list, there are too many other plugins.
I need help. I’m not seeing any results in the results page. I’ve used Relevanssi in the past (another blog), it worked, so I’m almost sure this has something to do with my theme (http://www.arrastheme.com/project-ar2/)
I copy/pasted the codes here: http://pastebin.com/a0hEanyc
Can you please tell me what to change? Thanks and I appreciate your hard work.
At least those codes have nothing unusual. ar2_above_content() might have something in it, but I’m not sure. And you’ve tried deactivating and reactivating the plugin and reindexing the content? Indexing works well?
Hi,
there are no documents in the index.
$wpdb->print_error(); Shows no error. So I debugged a query and tried to execute in in phpMyAdmin. The result was an error:
#1136 – Column count doesn’t match value count at row 1
Can I post (the very long) query here?
BTW: We use a Multisite Installation.
Cheers,
Lars
Lars, if you have free version on a multisite, that’s your problem there – you can’t use the free version of Relevanssi on multisite, it’s just not compatible.
Well, that’s strange. I came here looking for help with a problem similar to the original poster: ie. Relevanssi works great on my development laptop but doesn’t seem to be able to build the index on my live server. Both WP setups are the same, as I use git to sync changes between the dev and production servers.
The thing is, I’m using WP multi-site and Relevanssi most definitely *does* work –at least on my development machine. Unfortunately just not on the production server.
Hi. My Theme company (ElegantThemes.com) specifically recommended Relevanssi to use with their theme, “Origin.” They recommended Relevanssi to me because the standard WP search only returned search results from “posts” (but not “pages”).
I am not seeing any different behavior from Relevanssi, so I think it’s not working at all. I looked for “query_posts()” within my search result page (search.php), but found none. However, I am not a developer, so perhaps I am not looking correctly.
Here is the source for search.php. Do you see anything I should change?
Gratefully,
-Matt
=================================
<a href="”>
<?php if ( $thumb ” && !$et_ptemplate_showthumb ) { ?>
<a href="”>
<a href="” class=”readmore”>
Hmmm. my full page is not showing here, but when I click “edit” it shows… Can you see it? Or should I email it to you?
If both Relevanssi and default WP search are returning only posts and not pages, you have the post_type set to ‘post’ somewhere. Since your theme designer recommends Relevanssi as a solution, I suppose it’s not in the theme.
The best way to share template pages is to put them in a pastebin. You generally can’t copy and paste HTML and PHP code to comment forms and have it stay intact.
If you buy a Premium license, I’ll be glad to see how to get things working on your site; unfortunately there are limits to how much I can help people who are not Premium subscribers. If you show me your search results template and functions.php files, I can take a look at them and see if it’s something obvious.
Hello! i have a theme Infocus (themeforest) which seems to be not compartible with free version of Relevanssi as it is… so my question is: if i’ll buy the pro version of relevanssi will that fix the problem? or will i have support to fix that? i tried to find query_posts() in my theme files but i didn’t find anything like this…
what could be done fore better search results on my web-site (http://freak-cabaret.com/)? thank you!
Switching to Premium won’t change anything: it’s that similar to the free version. If you buy Premium, I can take a look at the theme, but I can’t promise that I can make it work with Relevanssi, and the support doesn’t include complex changes in your theme to make it compatible with Relevanssi.
Usually the problematic themes are fairly easy to fix, but not always. The more complicated a theme is, the harder it is to fix. If you can send me the search results template from your theme (usually it’s search.php), I can take a look at it and let you know if it looks like an easy job or a difficult one. My email is mikko@relevanssi.seravo.fi.
I have a Tab on a page titled FAQs. FAQ and FAQs does not show up in the results. Neither do any of the other tabs on that page. Any ideas how I can fix this?http://goldtouchinc.com/cosmichrome-spray-chrome/ I also noticed that a single search usually shows that it has been searched twice within a few seconds of each other. The results are doubled too.
It’s quite possible the contents of your tabs are invisible to Relevanssi. It all depends on how they’re done. Is it a shortcode? Or something else?
What comes to doubling of search results, that sounds like a problem with your search results template.
Hi,
I have installed Relevansii with theme Twenty twelve and it works perfectly.
But in another installation with plugin WPML and theme Construct a problem appears: Relevansii builds an Index but searches do not provide any results.
In WP control panel > Relevansii > settings I have enabled Polylang
On server… / WP content > plugins > Relevansi I renamed the directory to and the file to . Is it correct?
My theme’s file Search.php is available at if you like take it a look.
I have no experience as a developer and work for a non-profit organization. Can you help me to solve this problem, please?
The link to pastebin.com is not working, so just paste the plain URL here, without any HTML codes. Sounds like a problem with the search template, yes.
Hi, MS here it is: http://pastebin.com/dVnpkV3f
Ah, it’s a framework theme. Those are always more complicated to debug, as that template file contains nothing of use – the actual search page template is inside the mysite_search() function. Where that is, I don’t know. I can’t usually do much of a support for framework themes.
Thank you, M. So I go to ask about in the Forum theme support and if I get results, come back. In any case, I congratulate you and thank you for your work.
Hi, M. this is the framework response ???:
“We use the query_posts, you can find it in various areas in the
theme.php file. It’s used for lots of areas in the theme such as
excluding categories, portfolios, etc etc.
It would probably be best to try and find another plugin.”
Ok, so this sounds like switching search plugin or theme is the easiest solution here. I suppose Construct and Relevanssi can be made to work together, but it’s not going to be easy, and it’ll require changes to Construct files.
I share your opinion, Mikko.
I have passed your answer to Construct-framework developer (Mysitemyway) or which suggest me how can I Boolean and advanced search with its product Construct.
This is his response: “You would need a plugin or hire a custom freelancer to do that customization.”
Is it really necessary to hire a freelancer? As you know, we have no budget in this organization now =(
Well, unless you find someone to do it for free or do it yourself, then yes, you have to hire a freelancer. I know it’s complicated enough that I can’t do it for you for free.
I appreciate your opinion. I will discuss the case with the Foundation liable and if they have money, I will talk to you. Thank you
Hi I just updated to the last version and started getting mysql errors. I am not really sure what version I was but it was a recent one.
MysqlError: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘) AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM wp_posts AS posts W’ at line 2
Sample stack trace
…mysql_query called at /var/www/receitasdemae.com.br/html/wp-includes/wp-db.php (1213)
…wpdb::query called at /var/www/receitasdemae.com.br/html/wp-includes/wp-db.php (1538)
…var/www/receitasdemae.com.br/html/wp-content/plugins/relevanssi/lib/search.php (515)
…var/www/receitasdemae.com.br/html/wp-content/plugins/relevanssi/lib/search.php (971)
…var/www/receitasdemae.com.br/html/wp-content/plugins/relevanssi/lib/search.php (42)
in relevanssi_query called at ? (?)…
Index looks ok, I already tried recreating it. Also tried to disable/enable the plugin again.
Mysql version is 5.5.32
Is there any chance you could get me the problematic MySQL query in it’s full form?
For example, try this code:
add_filter(‘relevanssi_query_filter’, ‘rlv_q_f’);
function rlv_q_f($q) {
var_dump($q);
return $q;
}
Hi Mikko, I had replied to that days ago and for some reason the reply dissapeared. Maybe because of the SQL in the comment. So I will try to send it with a screenshot. The problem is that there is some ” IN () ” in the middle of it
Yes, that is the problem. Try the development version of Relevanssi available from http://wordpress.org/plugins/relevanssi/developers/ – does that help?
It looks ok with the development version, I see the results now. No error anymore. Thanks
Here is the screenshot
Yes, there is no way to paste an SQL statement here
Hi, your plugin displays my category results fine which i need, however it only displays the posts images and not the full text, I only see ………….
in the result and no text. Any idea how to fix it , thanks Greg.
Relevanssi doesn’t actually have much to do with what you see on the search results page, that is up to your search results template. Check your search results template.
“Appearance of new WP_Query() is another sign of trouble, or $wp_query->get_posts();. Anything that queries the database for new posts is trouble for Relevanssi.”
It is not clear by this comment if a theme has this within its code if this is a show-stopper not to use Relvanssi. Please provide what is the resolution if found.
Thank you
I am using theme Docs, and it contains:
function have_posts() {
global $wp_query;
return $wp_query->have_posts();
}
which is called within docs/index.php:
query_vars[‘post_type’]); ?>
ID );
if ( $post_type == ‘post’) {
get_template_part(‘templates/post’, ‘loop’);
} elseif ( $post_type == ‘page’) {
get_template_part(‘templates/page’, ‘loop’);
} else {
get_template_part(‘app/’ . $post_type, ‘loop’);
}
?>
My template uses “WP_Query()”, when I comment it out though it breaks the whole template. Should it be replaced with something else?
Yes, commenting out is not enough. Can you post your template to a pastebin?
Hi,
We have a custom taxonomy archive which shows no results when the Relevanssi plugin is enabled, without the plugin everything is fine.
In this taxonomy archive we have a query_posts to change the order of the items.
How can we make sure Relevanssi only does it’s thing on the search page and not on he taxonomy archive (or any other page)?
Thx!
This is a WP 4.0 feature. This code in your functions.php should solve the problem:
add_filter(‘relevanssi_prevent_default_request’, ‘rlv_fix_archive_kill’, 10, 2);
function rlv_fix_archive_kill($kill, $query) {
if (empty($query->query_vars[‘s’])) $kill = false;
return $kill;
}
Hi Mikko,
Thanks for your help!
I’ve added the code to my functions.php and it actually does what it is supposed to do (not replacing the request with “SELECT * FROM $wpdb->posts WHERE 1=2”).
But the taxonomy archive still displays no results, so I think it must be something after that.
Any ideas?
Thanks!
Try debugging the file lib/search.php; Relevanssi process starts in the relevanssi_query() function. What that function does on your archive pages?
In relevanssi_query() $search_ok is true so $posts gets modified, but even when I edit the function to return $posts as it is there are no results.
At this point $posts contains the right results.
Weird thing is that on the taxonomy archive page is_search() returns true after query_posts, before query_posts it returns false.
Does it help if you do unset($wp_query->query_vars[‘s’]); on the archive page?
Yes! That fixed it!
Thank you very much!
Mikko, I am running into this same issue, but the page is an ajax call. It doesn’t seem to be firing the filter because it’s on a blank template, due to it being an ajax call. Can you please tell me how to apply this fix for an ajax call?
Sorry, but I don’t know.
Hi. I am using implicit theme in WordPress version:4.0 for my website. And when I use these plugin in my theme it does not show any search results.And when I change the theme it works properly and show all results.
Can any one help me??
Well, did you read the instructions on this very page?
yes, I have tried all suggestions and read all conversations but still its not working for me.
Please post your theme search results template (usually search.php) to a pastebin and share the link.
2) {
foreach($builders as $builder) {
it_shortcode($builder);
}
} else {
echo do_shortcode(‘[blog title=”Blog” icon=”magazine”]’);
}
?>
check here….
http://pastebin.com/69Q8gRHb
Ok, that looks unusual. Sorry, I can’t help you with that theme, I don’t understand what that does.
Ok, Thanks for your reply.
But can you suggest me any option through which i can get some clue??
I’d say theme support, but since this is a plugin compatibility issue, they’re not going to help you.
please help how to remove search results query code to fetch the results from this search..please help..this is my search results whole code ..what to remove?
(found_posts; ?>)
<a href="”>
.
<?php get_footer();
Hassan, please post the complete code to a pastebin, looks like the comment form has eaten part of the code. If that is all the code, then your template is missing several required parts.
Hi Mikko! How do I replace the query so that the plugin works? thanks! http://pastebin.com/hNy0HvPu
Lia, no need to make changes, that search results template is Relevanssi-compatible.
but it doesn’t work! search turns out no results…:(
Lia, the problem is then in somewhere else. Have you built the index? Are the correct post types being indexed?
oh, sorry, now it’s ok! thanks!
Hello, we are using the premium version of this plugin.
In search results, we see the tag pages (we like that a lot) but when you click on the tag page title to see it, the link to all of these tag page results is just the home page. What can we do to have the link actually go to the tag page?
Here’s an example:
http://www.ablogtowatch.com/?s=rolex&orderby=post_type&order=desc
Thanks.
Hi, since you’re a Premium member, please use the Premium support service – it usually gets answers faster.
Anyway, changing the_permalink() on search results template to relevanssi_the_permalink() should do the trick. If this doesn’t work, please reply to the support email address (you can find on the sidebar in the Relevanssi settings page).
Hi,Mikko,help me with this problem.I want my clients to search something in my portfolio posts,that is where I put my product in.It seems like I can just search the words in the tittle!When I search some words in my portfolio posts,nothing appeared!I already set to index portfolio,but still I can’t search words in my portfolio posts but not in the tillte.Can you tell me how to work?
Not with this information. If Relevanssi can’t see the content of posts, it may be because you’re using shortcodes or page builders to create the content. Or is the content perhaps in a custom field?
Hi !
Just installed your plugin, it looks really great but i cant get any result on my search page.. Can you give me any advice to solve this problem ?
Here is the code of my search template : http://pastebin.com/4ed43LbR
Regards !
Nothing seems obviously wrong, but it’s a complicated enough template that I can’t say for sure.
I only see this message “Enable query logging to see stats here.” and an empty page. What should I do to see sth?
You should enable query logging, if you want to see the stats. If you want to see Relevanssi settings, you need to go to Settings > Relevanssi.
That video is based on Relevanssi 2.7.2. The vulnerability was fixed in 2.7.3, and Relevanssi has since been checked to make sure that all user input goes through necessary security measures.
This could be a great help resource if you would actually share what code to use besides what’s known not to work.
Ah, but that’s the thing: there is no code necessary. The default search results template (see for example WP default themes) works fine. If you have a problematic code (as mentioned in the post), just remove it, and usually you don’t need to add anything.
That’s true, if you have a default WP install. I had to develop in Timber + Bedrock, it’s a fork, slightly different, search uses. WP_Query in that version. If I remove that, obviously nothing will happen 🙂
The answer would be:
https://wordpress.org/plugins/relevanssi/faq/
“Direct access to query engine”
I’ll use that, it would be better to add it to a tutorial page.
That is very much beyond any basic tutorials. But since you’re a developer, it’s not that hard to use, really. Create a WP_Query object with the parameters you want and pass it to relevanssi_do_query(). If your WP_Query object is called $query, the results will be in $query->posts afterwards.
Yeah, thanks, I’ve read it in the FAQ, looks simple enough. I’m just suggesting to improve the docs, because it was very confusing for me, I found the FAQ by accident.
I don’t really know WP works, some code snippet or search.php setup might help people.
Hi,
using momizat multinews theme. I’ve tried to comment out WP_query, commented all out, but no result (or broken pages).Here is the search.php code
http://pastebin.com/9DiPJbfH
Can you help me?
You must also change $query->have_posts() to $have_posts() and $query->the_post() to $the_post().
Fatal error: Function name must be a string in /home/histor69/public_html/wp-content/themes/multinews-child/search.php on line 181
That is a if ( $have_posts() ) line….
Sorry, have_posts() and the_post(), not $have_posts…
Real respect for the fast answer. Unfortunately, did not help. No results are returned…
Your theme has enough modifications in the search results template that making it Relevanssi-compatible will require more work. Unfortunately some themes are like that.
Where to change “Search” button name in my language?
I don’t know. It’s not coming from Relevanssi, but your theme.
it is from either searchform.php or, in some cases, in heading.php.
Hi, my search stopped working for some reason… It doesnt show ANY results… but it did few days ago. I’m not aware of any changes.
https://www.autocadblog.cz/?s=DWG&submit=Search
I put this line in my search.php: global $wp_query; var_dump($wp_query->query_vars);
And this is the result, but I’m not clever from that:
[“author_name”]=> string(0) “” [“feed”]=> string(0) “” [“tb”]=> string(0) “” [“paged”]=> int(0) [“comments_popup”]=> string(0) “” [“meta_key”]=> string(0) “” [“meta_value”]=> string(0) “” [“preview”]=> string(0) “” [“sentence”]=> string(0) “” [“title”]=> string(0) “” [“fields”]=> string(0) “” [“menu_order”]=> string(0) “” [“category__in”]=> array(0) { } [“category__not_in”]=> array(0) { } [“category__and”]=> array(0) { } [“post__in”]=> array(0) { } [“post__not_in”]=> array(7) { [0]=> int(889) [1]=> int(601) [2]=> int(188) [3]=> int(880) [4]=> int(9) [5]=> int(757) [6]=> int(874) } [“post_name__in”]=> array(0) { } [“tag__in”]=> array(0) { } [“tag__not_in”]=> array(0) { } [“tag__and”]=> array(0) { } [“tag_slug__in”]=> array(0) { } [“tag_slug__and”]=> array(0) { } [“post_parent__in”]=> array(0) { } [“post_parent__not_in”]=> array(0) { } [“author__in”]=> array(0) { } [“author__not_in”]=> array(0) { } [“meta_query”]=> string(0) “” [“posts_per_page”]=> int(-1) [“ignore_sticky_posts”]=> bool(false) [“suppress_filters”]=> bool(false) [“cache_results”]=> bool(true) [“update_post_term_cache”]=> bool(true) [“update_post_meta_cache”]=> bool(true) [“post_type”]=> string(3) “any” [“nopaging”]=> bool(true) [“comments_per_page”]=> string(2) “50” [“no_found_rows”]=> bool(false) [“search_terms_count”]=> int(1) [“search_terms”]=> array(1) { [0]=> string(3) “DWG” } [“search_orderby_title”]=> array(1) { [0]=> string(40) “acadblogwp_posts.post_title LIKE ‘%DWG%'” } [“order”]=> string(4) “DESC” }
Hah, nevermind… I had new plugin from colleague: “Post Types Order”
And that did it… :-/
I’ve installed Relevanssi and built the index, but I cannot figure out how to make a search bar show up on my site anywhere. Any tips?
Just use the WordPress default search widget.
Thanks! That makes sense. It’s working now!
Hi. I’m sure this is a dumb question but I’m new to this and i don’t see any difference in the search function am i doing something wrong in the code? i just installed the plugin and created the index but the search isn’t any different?
Your theme is probably incompatible with Relevanssi. You can try switching to a default theme for a while – does the search have an effect then?
thank you for the really quick reply. I’ve just checked my custom mobile menu its working on that but not in desktop. I’m using Labomba is there any known issues with this theme do you know?
First time I’ve heard of the theme, so I don’t know. Does Relevanssi work with one of the default themes? In that case it’s a theme incompatibility, which most of the time can be fixed with the instructions on this page.
ah right ok. No i cant change my theme because of the one of the links to woocommerce. ill try and redefine the search term for the desktop because i know the mobile menu has a different term to the desktop. once again thank you for the quick reply!
I am attaching our search.php and I am not at all sure what stopped working after the latest update. There’s no query_posts or anything like that, and me being a very begginer WP user, I’m at a loss.
Pastebin: http://pastebin.com/rsVyZhLB
There is no problem with that template. Have you tried switching to one of the default themes and disabling other plugins to rule out conflicts?
Hi. I try to search for a woocommerce article number (sku).
The sku ist saved in a format like this: 978-3-3801-1010-3 but can also be shorter for example 971-4-313-334-1. If the user search exactly for this string, the product will be displayed. But often the user searches for the number without the “-“. Then the product will not be displayed. The fuzzy-search is active.
Do you know any workaround, to display the correct product also if the user searches for the sku without the “-“?
Yes, the solution is here: https://www.relevanssi.com/knowledge-base/words-ampersands-cant-found/
Perfect! Thank you!
Thank you for your great plugin.
I have a plugin (User Gallery Lite for Ultimate Member) and would like to use this plugin with Relevanssi plugin but unfortunately Relevanssi plugin can’t find this plugin (User Gallery Lite for Ultimate Member) in Indexing option table and can’t index my images when I upload them to database. Can you please help me to modify your code in order to find the plugin in indexing option table?
Thanks,
Alex
Sorry, can’t help you there. If the images are not a custom post type, but instead in a separate database table, Relevanssi has no access to them, and it’s really difficult to fix.
I am so sorry this is elementary, but I do not know how to get the this search functionality on my top navigation bar next to Contact? Any help appreciated. I have installed and activated the plug-in.
Looks like this plugin might help you: https://wordpress.org/plugins/bop-search-box-item-type-for-nav-menus/
Hi,
I was wondering whether your plugin can index more than 100,000 images? If no, what plugins you suggest for large database?
Thanks,
Alex
No, it’s way too much for Relevanssi. Use Solr.
How do I fix the search button being misaligned with the text box. I know this is something simple but I just don’t know what to do.
https://uploads.disquscdn.com/images/5a7ef026d93a53c36149a4a1911e1330d04f045e616e01e4afa0d17d219f419e.png
Can’t really help just based on image; seeing the site and the CSS code would help. But this is not Relevanssi-specific, anybody with CSS skills can help you with this.
How can i give the post title the first priory in the relevanssi order?
Increase the title weight in Relevanssi settings.
Is there a link to adding images to search return? I am trying to differentiate between products and posts, and images would help greatly but I can’t get them to populate. And I can’t find a post about this issue.
Is there a link to adding images to search return? I am trying to differentiate between products and posts, and images would help greatly but I can’t get them to populate. And I can’t find a post about this issue.
The post type is stored in $post->post_type. You can use that to display different images for products and posts.
There’s no documentation about this here, because it’s not a Relevanssi issue, but instead depends on your theme.
Hi,
I am having an issue with searches on the front end of our website. When I enter the SKU #, description, name, and/or keywords into the product tags, Relevanssi usually pulls up the product I am looking for, but if I don’t have any tags entered in, it won’t find the product. Usually not even close, either. The back end works just fine, but I can’t pull up the product I’m looking for on the front end of the website. Short of entering tags for every product, I don’t know what to do. Any suggestions?
Are you sure the search is powered by Relevanssi in the first place? If you disable Relevanssi, does that make any difference at all in the search?
In order for Relevanssi to find products by SKU, you must adjust Relevanssi settings so that the “_sku” custom field is being indexed. Have you done that?
I wasn’t the one to initially set it up, so I’m not sure what was done. I did try disabling it, and re-enabling it, and both did little to nothing. How do you adjust the sku custom field?
Add “_sku” to the list of custom fields to index, rebuild the index. That should do the trick. But disabling Relevanssi should modify the search results, if they are powered by Relevanssi, so if nothing happens, they’re not.
Where would I locate the list of custom fields? Is there any way you can post a screenshot of what you’re talking about? I’m sorry, I am learning about all this as I go. I’m in no way a coding expert. Thanks for your help.
Go to the Relevanssi settings page and look at the indexing settings – you’ll find it there.
Hi,
Thanks for the great information and your quick response times. I am using a Theme named “Porto” for my woocommerce shop and I don’t think the search results page is showing Relevanssi results due to some code on the search.php page.
Fixing that is beyond my skill set and I was wonder, do you have any recommendations to edit search.php or can help me get this going?
Jason, post your search.php to Pastebin or somewhere like that, and I can take a look at it to see if there’s something obvious.
Here it is…thank you!
https://pastebin.com/7DfDTu6D
Nothing obviously wrong there, though some slightly curious bits. But nothing that should prevent the search from working. Does disabling Relevanssi change the results at all?
Hi
I have problem. Plugin dont show search results.
Can u help my?
This is my search.php
https://pastebin.com/ZrKF2G62
Kathe, nothing wrong with the template. Do you have a complete index, with all the necessary post types indexed?
Hey,
I’m completely new to wordpress. The guy who built the site has a search system already in place. There is a search.php and presumably a searchform.php somewhere. I want to replace the current search system with your search system. Here is the pastebin of the code in the header menu bar, where the search field is located: https://pastebin.com/xdHZh84g
Sorry i can’t be more helpful, i’m very new but eager to learn
Rsk, just install and activate Relevanssi, that should do the trick.
It would seem installing it just makes the search function worse. Previously it would just show the page link where the term was found, Relevanssi seems to show less results and won’t show any excerpts. It also still gives the message from my original search.php if nothing is found.
I’m certain everything is indexed, i’ve tried to deactivating and reactivating. Even on the basic settings after just indexing it doesn’t seem to work. I have posts, pages and attatchments indexed. When it does actually find something it won’t show any excerpts, but it rarely finds something.
Thanks so much for the quick reply!
Relevanssi uses the same template as your default search, so the look of the search results page should not change when activating Relevanssi. If it does, then your current search is doing something non-standard and needs to be returned to be more in line with the default WP search.
Hi
Installing Relevanssi with WP : quite correct except one point : “no posts found” with a research with only a figure.
For example, a research with only “2” doesn’t work while a research with “2cv” works.
Is there an option I’ve not pointed ?
Thanks for your response
Michel79, Relevanssi has a minimum word length of 3, and won’t search or index words shorter than that. See “Advanced indexing options” on the Indexing tab. You also need to add a filter function on the hook
relevanssi_block_one_letter_searches
that returnsfalse
, if you want to allow one-letter searches.OK
Many thanks
Is there a way to modify the last ‘SELECT * FROM wp_posts WHERE id IN…’ query I’ve used relevanssi_query_filter and when I search “fm”, the query looks like this:
_________________________________________________________________
SELECT relevanssi.*, relevanssi.title * 5 +
relevanssi.content * 1 + relevanssi.comment * 0.75 +
relevanssi.tag * 0.75 + relevanssi.link * 0 +
relevanssi.author + relevanssi.category * 0.75 + relevanssi.excerpt +
relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf
FROM wp_relevanssi AS relevanssi WHERE (relevanssi.term LIKE ‘fm%’ OR relevanssi.term_reverse LIKE CONCAT(REVERSE(‘fm’), ‘%’))
___________________________________________________________________
With this, when I run the query in workbench, I get 350 rows of info, which is great, however on my page, I only get 11 returns, because of that first query most of the items are coming from the same page, so it treats it like one.
I need to grab the relevanssi.terms column and join that with info from a custom table, then have it return with all the data. There doesn’t seem to be a hook for that. Any ideas on how this can be done?
Preferably without altering the plugin itself.
Jason, I’m not sure I understand what is the problem here. Relevanssi may find 350 rows of matches for something, but if those matches are within 11 posts, Relevanssi will show 11 results, and there’s no way to make it show more, because that’s how Relevanssi works.
“I need to grab the relevanssi.terms column and join that with info from a custom table, then have it return with all the data. There doesn’t seem to be a hook for that. Any ideas on how this can be done?”
How is this related to the Relevanssi search? If you need to access the data for some other purpose, then create a SQL query that does that. But if this is related to regular WordPress search, please explain a bit what you’re looking for to achieve here. I don’t understand, and can’t help you because I don’t know what you are trying to do here.
If you’re talking about the “SELECT * FROM $wpdb->posts WHERE id IN ($ids)” query in relevanssi_populate_array(), it can’t be modified, because changing how it works would break Relevanssi. It needs to read in all the result posts from the database and store them in the Relevanssi cache array.
Hi Mikko,
I’m using Elite Masters WordPress theme and I really want to use your Search plugin, because it is the best compared to others.
Unfortunately I have problem. When I’m suing this theme the search results page doesn’t show any results. I switched back to the default WP theme and the search results appear.
I don’t have any coding skills. Can you help me to modify the search.php so it works?
Here it is: https://pastebin.com/uNAVK7HX
Thank you in advance!
Kevin, you can try this: https://pastebin.com/ZRaEr9rd
Just make sure you have the original version handy in case it doesn’t work. The theme as it is is indeed totally not compatible with Relevanssi.
Hi Mikko,
I tried your version of search.php but it doesn’t work. I’m getting 500 Internal Server Error so I reverted the changes 🙁
Probably some small typo there somewhere. Didn’t notice right away where, would take some patient debugging to figure it out.
Hi Mikko,
I am using Relevanssi with Avada theme. The problem is that the first search result is replacing all my upper menu links. You can see the problem example here: http://lahde.gtk.fi/?s=Kuopio
Here you can find Avada search.php file: https://pastebin.com/WqnR7Ahj
Thank You,
Jari
Hi Mikko,
I am facing the usual Relevanssi problem. Its not showing any search results, since I am using AMP plugin https://wordpress.org/plugins/accelerated-mobile-pages/ .
I tried to hack it for last few hours, but this require little bit more PHP knowledge.
I think i found right files, so I can list them over here.
This is a loop.php file and i think in there is search template https://gist.github.com/shtefcs/a29e6a9ec7bcd095eb6ee313118b4101
And this is search.php, i think its just some function there for search form: https://gist.github.com/shtefcs/a2258f34b2d046f353d8a549bb7b32e3
I would really appreciate for your help Mikko. I also believe that your fix can be great for AMP plugin compatibility and that you could send PR to their github https://github.com/ahmedkaludi/accelerated-mobile-pages
Peace,
Stefan, I made a suggestion on the loop.php gist. Does that help?
Man you are awesome. It worked on first try.
Thank you a lot.
Maybe suggest to AMP guys ur fixes, so Relevanassi become compatible with it. AMP is big and will be standard in future.
Peace,
Stefan, I’ve added a pull request for this. Let’s hope it gets accepted.
Great, I commented. They should accepted it.
Dear Mikko,
My search page also shows no results with Relevanssi activated. Here is the contents of my search.php file: https://pastebin.com/S7FtcV3u
I really hope you can help me out with this!
René, there are no problems with your search results template. Do you have an index? Are your Relevanssi settings correct? Weights make sense, no category restrictions, post types correct?
Hi Mikko,
Sorry it took so long to reply. In the mean time, I have bought the Premium version of Relevanssi, but the problem persists. I do have an index, and the Relevanssi settings are correct (as far as I can tell).
Here is a screenshot of asearch results page (example: https://dev-mindthegap.somo.nl/?s=virginia)
1) with Relevanssi deactivated (working) – https://rvlak.stackstorage.com/s/wIKHYRaC9DPYo9Q
2) with Relevanssi activated (empty page) – https://rvlak.stackstorage.com/s/mTQJ2IA4VZYmORa
If you need access to the backend for debugging purposes, please let me know. I will also put in a regular support request for this.
P.S. I have found the culprit. A long time ago, I added the BuddyPress Global Search plugin, and I forgot it was there. When I deactivated it, the search page was working properly again. So it was the BuddyPress Global Search plugin that conflicted with Relevanssi.
Hi, Relevanssi is not working in our site here is the code of my search.php https://pastebin.com/SQqihtd0
I already added the code below to my function.php.
add_filter(‘relevanssi_modify_wp_query’, ‘rlv_meta_fix’, 99);
function rlv_meta_fix($q) {
$q->set(‘meta_query’, ”);
return $q;
}
Relevanssi setting is also okay.
Any thoughts?
Dale, your search results template is full of custom MySQL code that fetches the results, that’s all overriding what Relevanssi does. In order to use Relevanssi, most of that needs to be removed.
Hi, I don’t know what are the codes that need to remove. I’m not a programmer as well so I don’t know what to put or remove there. Do you know what codes will I need to remove there?
Sorry, but this is too complicated thing to explain to a non-programmer. It would require a very thorough rewrite of the whole template file. It’s doing some very unorthodox things with the search right now.
The plugin is working fine apart from one aspect, Page 2 of *some* search results goes to a 404 Page, despite there still being more posts to show. Have you come across this before?
Try clicking the search link below (Website), then go down to “Next Page” and click that. 404. What’s super weird is that if you search for anything other than Cardwell Higgins, eg. Henry Clive, that second page of results works. I can’t figure out for the life of me why.
Nigel, can’t tell for sure, but one thing I’ve sometimes seen happen is that Relevanssi only finds one page of results, but the paging is based on the default WP search, which finds more results for some reason.
Thanks Mikko. The thing is that there are definitely more results from that artist than contained on the first page. If I disable Relevanssi, then I can see them.
If you add the “Look at the results” step here: https://www.relevanssi.com/knowledge-base/debugging-relevanssi-searching-issues/
How many results does that print out?
I’m encountering this exact thing myself (paging showing more pages than Relevanssi actually returns) – any fix for this scenario?
Ben, how is the paging built? It shouldn’t use any custom queries, just the normal WP paging functions.
Hi Mikko,
Hope you can help? I am a newbie, so please forgive my errors/omissions. I installed and activated your plugin. Twice per your debugging instructions. The search page is not returning any results. I am happy to buy your premium plugin if I can get it to work.
I have two searches:
1) Blog (http://146.66.101.125/~dandel50/deve/blog/) should only search posts
2) Store (http://146.66.101.125/~dandel50/deve/services/) should only search products
I am not sure if your plugin impacts just the blog search or also the product search? The product functionality is all WooCommerce. When I installed your plugin, I only I used your index functionality (I did not configure anything else).
I am using Elementor on the backend and an Astra theme.
I get no search results via relevanssi, although, the image behind the search box is dynamic to show the hero image of page’s top post on the Blog page and the top product on the Product page and the images change as I use search, implying something is happening but just not displaying. Search was working before I implemented relevanssi, but it was mixing blog and product content together. Hence, the reason I wanted relevanssi (to help me only show posts on the blog search and products in the product search).
Can you help?
Thanks,
Mike
Mike, Relevanssi will take over both searches: they’re the same search, underneath it all.
You’ve got the product search covered: it has the post type restriction to the “product” post type. However, your main search has no post type restriction, and will then show all posts, including products. If you don’t have any pages you want to include in the search, you need to restrict the main search to the post type “post”. If you want pages, too, then “post,page”. That’s done by adding a hidden input field in the search form:
<input type=”hidden” name=”post_type” value=”post,page” />
The default settings are mostly fine, but make sure the “product” post type is included in the indexing settings.
Can you show me your search results template? It’s the file search.php usually, you can put it in a Pastebin and share the link to me.
Thanks for the quick reply. I am hesitant to edit PHP. (I am not a developer). I have two concerns: (1) future maintenance of wordpress/plugin compatibility with the PHP edits and (2) forgetting where the edits were made. Any solutions to help with this?
Here is the pastebin:
https://pastebin.com/7ii2jCUS
Thanks!
Mike, looks like the theme you’re using is not compatible with Relevanssi, or making it compatible would be a really big job.
Thanks, Mikko. Can you tell me what you are seeing that tells you it isn’t compatible? I can submit a ticket to the Astra (the theme maker). Or, Elementor (the page builder). Thanks!
It’s the theme, it hides the post loop to some custom code:
It would be possible to make it compatible with Relevanssi, but it takes lots of custom modifications.
All Relevanssi wants is a basic loop, but your theme likely has a non-basic loop.
I do not know, how to install in a theme with visual composer. Can anybody help me?
Nicole, nothing special in it. Visual Composer should not affect Relevanssi installation in any way. Just install the plugin, build an index and off you go.
Could someone please explain to me like i’m a three year old what I’m looking for and how to change it (regarding the below two paragraphs on query posts)
I have the following php search files
public_html/wp-content/upgrade-temp-backup/plugins/elementor-pro/modules/theme-builder/conditions/search.php
public_html/wp-content/upgrade-temp-backup/plugins/elementor-pro/modules/theme-builder/documents/search-results.php
public_html/wp-content/upgrade-temp-backup/plugins/elementor-pro/modules/theme-elements/widgets/search-form.php
public_html/wp-content/upgrade-temp-backup/themes/hello-elementor/template-parts/search.php
public_html/wp-content/themes/hello-elementor/template-parts/search.php
Do I change all of them? And what exactly do I do, please??
Many thanks
“If you’re having problems with Relevanssi, the first step is to check your search results page, usually search.php. See if there’s a call to query_posts() and if there is, comment it out. In most cases that is enough to fix the problem.
It’s not always query_posts(). Appearance of new WP_Query() is another sign of trouble, or $wp_query->get_posts();”
Audrey, you are using Elementor, so none of this applies to you. Your problems are caused by something else. Please post a question on the Relevanssi support forums describing your problem.