• Resolved wpwebdevn

    (@wpwebdevn)


    I’m running the most recent version of Wp and Relevanssi. I’ve gone through the documentation and a lot of posts online, to rule out the main issues. I’ve set everything up in the admin for what I believe is needed to index content from “Pages” but I’m still not able to get results from their content in search. It’s bringing back results for Posts, Portfolio, Tags, etc. — everything I’ve set to index, but I just cannot get it to display pages in search results. Any ideas?

    Thanks for the great plugin…I have no problem paying for the premium version if it fixes this issue.

    https://www.ads-software.com/extend/plugins/relevanssi/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter wpwebdevn

    (@wpwebdevn)

    Also, I’m running into another odd issue. When searching and there are more results so pagination is used, when you click to the next page, it combines multiple keywords and then the page errors out as nothing found. Here is an example of how it’s working.

    I make a search for the keyword phrase “first second” and it brings back 15 results with the first page showing 10 results and having a URL of:

    www.domain.com/?s=first+second

    …if I click the “2” or “NEXT” button to see the last 5 results, it comes back with no results and the URL is now:

    www.domain.com/page/2/?s=firstsecond

    …however, if I change the URL so it includes “+” and doesn’t combine the keywords into one long word, so it reads:

    www.domain.com/page/2/?s=first+second

    …it displays those last 5 results.

    So, how can I get it not to combine the words? This is in addition to my first post above about it not listing pages in search results.

    Thank you!

    Plugin Author Mikko Saari

    (@msaari)

    Your second problem is not Relevanssi behaviour, but peculiar to your particular setup. I don’t know what’s causing that.

    For your first problem, I’d check $wp_query to see if something is restricting the post type ($wp_query->query_vars[‘post_type’]).

    Thread Starter wpwebdevn

    (@wpwebdevn)

    Mikko, thank you very much for your quick reply. As for my second request, yes, there was a Pagination file that must have been causing this issue, although I hadn’t experienced it erring out that way before. I just bumped up the number of “blog pages to show at most” up to avoid pagination and that issue, so I’ll consider that “fixed”.

    As for the $wp_query, I’ve searched through all the files on this WP install and cannot find anything that would restrict the post type. I also read your article on this issue before contacting you, I’ve worked through a lot before I bugged you about this.

    I’ve now gone through adjusting a lot of settings in the “Relevanssi Search Options” and saving and reindexing, and still am getting no Pages to come back in search results…I do get Post results as well as Portfolio items. Their are no no stopwords listed and only 65 documents to index (I have 21 Pages, 5 Posts, and 39 Portfolio items) so that makes sense.

    The site is still in development, but you can view it through the links below…
    NO RESULTS FOR “CHAIRS” — https://www.nfiportfolio.com/?s=chairs
    SAMPLE PAGE WITH “CHAIRS” IN TITLE AS WELL AS BODY COPY — https://www.nfiportfolio.com/all-our-chairs/
    SHOWING POST RESULTS FOR “CHAIR” (SINGULAR), BUT NOT THE “ALL OUR CHAIRS” PAGE THAT INCLUDES THAT IN THE IMAGE CAPTION ON ITS PAGE: https://www.nfiportfolio.com/?s=chair

    I’d love to get this to work because I’m a big fan of the other functionality it has, and it would make sense to get the Premium version if it added more features and worked on my site.

    I really appreciate your help on this…this is the last real issue we have before being able to launch our site.

    Thread Starter wpwebdevn

    (@wpwebdevn)

    Here is a section of code from my “search,php” file — it doesn’t have the $wp_query in it, but maybe this is the issue…

    <?php if ( have_posts() ) : ?>
    
    			<div id="page-title">
    				<h1><?php printf( __( 'Search Results for: %s' ), get_search_query() ); ?></h1>
    			</div>
    
    			<?php while ( have_posts() ) : the_post(); ?>
    
    			<article id="post-<?php the_ID();?>" <?php post_class('entry-wrap');?>>
    				<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    
    				<?php the_excerpt(); ?>
    			</article>
    
    			<?php endwhile;

    …do I need to change it to include “pages” and not just “posts” somehow?

    Plugin Author Mikko Saari

    (@msaari)

    That sample code you have is not a problem. To WordPress pages are just a subtype of posts.

    Really hard to say what’s wrong without taking a look under the hood, so to speak. If you do a

    global $wp_query; var_dump($wp_query->query_vars);

    on the search results page, what do you get? Can you post the results of that in a pastebin, for example?

    Thread Starter wpwebdevn

    (@wpwebdevn)

    Mikko, thanks again for getting back to me on this. I added the code you provided to the the search.php and here is what it generated:

    array(57) { ["s"]=> string(5) "chair" ["error"]=> string(0) "" ["m"]=> int(0) ["p"]=> int(0) ["post_parent"]=> string(0) "" ["subpost"]=> string(0) "" ["subpost_id"]=> string(0) "" ["attachment"]=> string(0) "" ["attachment_id"]=> int(0) ["name"]=> string(0) "" ["static"]=> string(0) "" ["pagename"]=> string(0) "" ["page_id"]=> int(0) ["second"]=> string(0) "" ["minute"]=> string(0) "" ["hour"]=> string(0) "" ["day"]=> int(0) ["monthnum"]=> int(0) ["year"]=> int(0) ["w"]=> int(0) ["category_name"]=> string(0) "" ["tag"]=> string(0) "" ["cat"]=> string(0) "" ["tag_id"]=> string(0) "" ["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) "" ["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(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_type"]=> array(2) { [0]=> string(4) "post" [1]=> string(9) "portfolio" } ["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) ["posts_per_page"]=> int(99) ["nopaging"]=> bool(false) ["comments_per_page"]=> string(2) "50" ["no_found_rows"]=> bool(false) ["search_terms"]=> array(1) { [0]=> string(5) "chair" } ["order"]=> string(4) "DESC" }

    …anything in there that sends any red flags your way? As I mentioned previously, if you need to get “under the hood” and have a consultant fee for fixing this, I’d be happy to pay it for the help. This search system working is the last piece of this puzzle need to launch the site. I look forward to hearing from you.

    Thanks!

    Plugin Author Mikko Saari

    (@msaari)

    That search is restricted to post types “post” and “portfolio” – that is keeping the pages out of the results. You need to figure out where that restriction comes from and remove it.

    Thread Starter wpwebdevn

    (@wpwebdevn)

    Mikko, I’ve spent countless hours on this and it still won’t display search results. I have no idea why not and this is preventing finalizing the site and launching it. I even tried getting the code from search.php from the default WP theme, but it still doesn’t work. Are you saying there is some setting with your plugin, Relevanssi, that is blocking pages from being showin the search results, or there is any issue with the theme that’s blocking them?

    Thanks again for your help, this is killing me…

    Plugin Author Mikko Saari

    (@msaari)

    I’d first take a look at your search form – not the search results template. Does it have something like a <input type="hidden" name="post_type" value="post,portfolio" />?

    Drop me an email with user account details to your admin dashboard to mikko @ mikkosaari.fi, and I’ll take a look – might be something simple.

    Plugin Author Mikko Saari

    (@msaari)

    Problem solved: the theme had this lovely bit of code in functions.php, filtering the post types:

    /*----------------------------------------/
    	EXCLUDE / INCLUDE TO SEARCH QUERY
    /----------------------------------------*/
    function pt_search_query($query) {
      if( !is_admin() ){
        if ($query->is_search) {
          $query->set('post_type', array('post', 'portfolio'));
        }
        return $query;
      }
    }
    
    add_filter('pre_get_posts','pt_search_query');

    Hi…
    nice, but… what did you change to make it search the page content too?

    thank you in advance,
    Landis.

    Plugin Author Mikko Saari

    (@msaari)

    The post types that Relevanssi indexes are defined on the Relevanssi settings page. Just check the box for post type “page”, rebuild the index and you’re good to go.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Everything but "Pages" content is being returned in Search results…’ is closed to new replies.