Nothing Found – error for search
-
hi,
i have installed and configured the plugin on my WordPress website, but for all the search keywords it gives me “Nothing Found – Sorry, but nothing matched your search criteria. Please try again with some different keywords.” error
can you please help me to fix this?
looking forward to hear from you..
regards,
Jay
The page I need help with: [log in to see the link]
-
That URL you give is incorrect: the search term parameter should be
s
, notq
. Your site search form has it right, though.So you have a complete index for Relevanssi? Can you show me the search results template from your theme, please?
hi,
Thanks a lot for your reply, i have changed the search term parameter to s (https://pph.addrenhost4.com/search-results/?s=pets)
here i have attaching my search template – download this zip file and see (https://pph.addrenhost4.com/search.zip) or full code below
<?php /* Template Name: Search Results */ ?> <?php get_header(); ?> <main> <!-- secondary navigation--> <div class="horizontal-bar secondary-navigation"> <div class="container"> <nav class="navbar navbar-default bannerBttmCustomNav" role="navigation"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex2-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse navbar-ex2-collapse" id="bannerBttm"> <ul id="bannerBttmNav"> <?php wp_nav_menu( array( 'menu' => 'subnav', 'theme_location' => 'subnav', 'depth' => 3, 'menu_class' => 'nav navbar-nav bannerBttmNavigation', 'fallback_cb' => 'wp_bootstrap_navwalker::fallback', 'container' => false, 'walker' => new WP_Bootstrap_Navwalker() ) ); ?> </ul> </div><!-- /.navbar-collapse --> </nav> </div> </div> <!-- ./ secondary navigation--> <!--Main layout--> <div class="container" style="padding:40px; line-height:30px;"> <!--page contents--> <div class="row"> <!--Main column--> <div class="col-sm-12 col-md-12 col-lg-12" style="font-size:16px"> <?php if (function_exists('zeno_font_resizer_place')) { zeno_font_resizer_place(); } ?> <div class="entry-content-page"> <!--<h3>Search Results</h3>--> <?php wp_reset_query(); $s=get_search_query(); $args = array( 's' =>$s ); // The Query $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) { _e("<h3>Search Results for: ".get_query_var('s')."</h3>"); while ( $the_query->have_posts() ) { $the_query->the_post(); ?> <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4> <p><?php $content = get_the_content(); $content = strip_tags($content); echo mb_strimwidth($content, 0, 100, '... '); ?></p> <?php } }else{ ?> <h2 style='font-weight:bold;color:#000'>Nothing Found</h2> <div class="alert alert-info"> <p>Sorry, but nothing matched your search criteria. Please try again with some different keywords.</p> </div> <?php } ?> </div> <hr/> <?php // TO SHOW THE PAGE CONTENTS foreach(getPostsData($_GET['q']) as $post){ ?> <h4> <a href="/<?php echo get_page_uri($post->ID) ?>"> <?php echo $post->post_title ?> </a> </h4> <p> <?php echo truncateMe($post->post_excerpt,200) ?> </p> <hr /> <?php }//resetting the page loop wp_reset_query(); //resetting the page query ?> </div> <!--Main column--> <?php /*?> <!-- right sidebar--> <div class="col-sm-12 col-md-12 col-lg-4" style="font-size:16px"> <div id="sidebar"> <?php if ( is_active_sidebar( 'page-side-bar' ) ) : ?> <?php dynamic_sidebar( 'page-side-bar' ); ?> <?php else: ?> <h5>No Widget Add On Page Sidebar</h5> <?php endif; ?> </div> </div> <!-- ./right sidebar--> <?php */?> </div> </div> <!--/.Main layout--> </main> <div class="footer-section"> <div class="footer subFooterMenu"> <div class="container"> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-3 footer-one"> <h5>Health Topics</h5> <ul> <?php wp_nav_menu( array( 'menu' => 'footermenu1', 'theme_location' => 'footermenu1', 'depth' => 1 )); ?> </ul> </div> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-3 footer-two"> <h5>For Professionals</h5> <ul> <?php wp_nav_menu( array( 'menu' => 'footermenu2', 'theme_location' => 'footermenu2', 'depth' => 1 )); ?> </ul> </div> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-3 footer-three"> <h5>Clinics</h5> <ul> <?php wp_nav_menu( array( 'menu' => 'footermenu3', 'theme_location' => 'footermenu3', 'depth' => 1 )); ?> </ul> </div> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-3 footer-four"> <h5>Classes</h5> <ul> <?php wp_nav_menu( array( 'menu' => 'footermenu4', 'theme_location' => 'footermenu4', 'depth' => 1 )); ?> </ul> </div> <div class="clearfix"></div> </div> </div> </div> <?php get_footer(); ?>
Your template does things that disable Relevanssi, for no particular purpose. All that extra WP_Query does is to remove all search parameters, making it impossible to filter searches by any method.
This version should work better with Relevanssi: https://gist.github.com/msaari/5a847b0ea5162223d618114e847a0c1f
hi,
thanks a lot for your reply..
i have replaced the search template with the new version file that you given but still not working..
have a look at this link: https://pph.addrenhost4.com/search-results/?s=pets
please help me on this whats going wrong?
regards,
JayThe search results page is actually here: https://pph.addrenhost4.com/?s=pets
ok thanks a lot and i will let you know how its working..
regards,
jayhi,
i am getting the same issue when i try to integrate the same into the live site.
Live Site: https://www.peterboroughpublichealth.ca/?s=pets
what i did:
1. installed and activated the “Relevanssi – A Better Search” plugin
2. replaced the search template with new template file that you givenIt shows the same error that the test website showed, now the test site seems to be working fine.. (https://pph.addrenhost4.com/?s=pets)
Did you build the index? Do you have correct numbers in the Indexing tab of Relevanssi settings? Reasonable words in the “Most common words” list on the Stopwords tab?
If the index is fine, do the first two steps here and report what they do: https://www.relevanssi.com/knowledge-base/debugging-relevanssi-searching-issues/
- The topic ‘Nothing Found – error for search’ is closed to new replies.