Welcome! To use this support forum, please Login or Join Today!

You are here → Home :: Forum Home :: General WordPress :: Plugins Discussion :: Thread

   

Relevanssi Search results not displaying

{name}
RankRank

Total Posts: 33

Joined 2012-09-21

PM

 
Hi,

We are using the Relevanssi search plug in (http://wordpress.org/plugins/relevanssi/) with the Synapse theme. It has been working until recently. I suspect about the time that I updated the theme to the most recent version.

The search result page does correctly appear and states:
Search Results for: word correctly appears here
The following results were found:

-- but no results are displayed below that. I have checked the search logs and hits are being found, tracked and there are a number of hits. So I know the search part is working.

On the Relevanssi FAQ page I have followed the instructions if the search does not work

If you the results don't change after installing and activating Relevanssi, the most likely reason is that you have a call to query_posts() on your search results template. This confuses Relevanssi. Try removing the query_posts call and see what happens.


But it doesn't seem query_posts is being used by the Synapse theme.

Any suggestions on what I could do to get this working?

Thanks.

{name}
RankRankRankRank

Total Posts: 3667

Joined 2011-04-27

PM

 
Hi, there is a reference to query_posts() in /loops/loop-search.php.
Can you try editing that file and let me know if that solves the problem?

If so, there's more than likely a way we can customize the child theme to override the search results, but first I'd like to know if that is indeed the problem.
{name}
RankRank

Total Posts: 33

Joined 2012-09-21

PM

 
That does the trick. I commented out the query_posts line of code in the loop-search.php and search results now are being displayed.

Here is the line of code I commented out:
/*query_posts( $args );*/ 


Can I copy the loop-search.php file into the child theme folder, with that line commented out or is there something more I need to do?

I have to dig a little deeper, the results are coming back as a bullet list of page titles, and some nothing next to a bullet. Not sure if that is an issue with my Relevanssi settings.
{name}
RankRank

Total Posts: 33

Joined 2012-09-21

PM

 
Quick followup question - where can I change the setting to display more than 3 search result hits on a page? I am seeing that some keyword searches are getting 24 hits but I can only see 3 on a page.
{name}
RankRankRankRank

Total Posts: 3667

Joined 2011-04-27

PM

 
Yes, you can just create a folder inside your child theme named "loops" and copy over your edited loop-search.php.
{name}
RankRank

Total Posts: 33

Joined 2012-09-21

PM

 
Quick Update: To try to debug a bit more:

1. I deactivated Relevanssi and installed Search Everything http://wordpress.org/plugins/search-everything/

2. I removed the commented out code in the loop-search.php so it is back to your original code

3. And the search works, it displays a good list of hits on the first page (not only 3). And I can tell it's the Search Everything results because it is showing the custom highlight color I selected.

So the search and search results are working better with this plugin.

My new question is - how do I get the page title and abstract of the content to appear on the search results page? I am still only seeing a bullet list with page titles and I'd like more context. Is this more a question for the plugin support?

Thanks!
{name}
RankRankRankRank

Total Posts: 3667

Joined 2011-04-27

PM

 
That's actually in the template, so you can change that markup to whatever you like. Here's a more traditional post-like feel with excerpt:

loop-search.php:
http://hastebin.com/licawuboha.php


{name}
RankRankRankRank

Total Posts: 3667

Joined 2011-04-27

PM

 
Just to add to the above, if you wanted to display the post thumbnail next to each result, just add:

<?php echo get_the_post_thumbnail( $post_id, 'squared150', array('class' => 'scale-with-grid alignleft') ); ?>


just before:

<?php the_excerpt();?>