• Resolved ed-fusionary

    (@ed-fusionary)


    Hello,

    I’m helping troubleshoot a site which uses the relevanssi plugin to do search. Right now we’re not getting results from blog posts, only from pages.

    I’ve followed these instructions: http://www.relevanssi.com/knowledge-base/how-to-debug-indexing-problems/ to confirm that blog posts are being indexed correctly. I’ve also examined the database to confirm that the terms actually made it into the database.

    Hacking around inside relevanssi, it appears that the query being built looks something like this:

    SELECT relevanssi.*, relevanssi.title * 5 + relevanssi.content + relevanssi.comment * 0 + relevanssi.tag * 1 + relevanssi.link * 0 + relevanssi.author + relevanssi.category * 2 + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf FROM wp_relevanssi AS relevanssi WHERE relevanssi.term = 'energizing' AND ((relevanssi.doc IN (SELECT DISTINCT(posts.ID) FROM wp_posts AS posts WHERE posts.post_type IN ('page'))) OR (doc = -1)) ORDER BY tf DESC LIMIT 500

    and the problem is the posts.post_type IN ('page') — obviously it’s excluding blog posts, which have post_type ‘post’. But I wasn’t able to reason out exactly how it gets set to do that.

    This is a paste of our theme’s search template: http://pastebin.com/A22cc0QW

    I’d be grateful for any advice.

    https://wordpress.org/plugins/relevanssi/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Your theme (or something else, but probably your theme) is forcing the post type in the query variables. Check the theme options, there may be an option that restricts the search to pages. If you can’t find it, you can try this:

    add_filter('relevanssi_modify_wp_query', 'rlv_adjust_post_type');
    function rlv_adjust_post_type($q) {
        $q->query_vars['post_type'] = 'any';
        return $q;
    }
    Thread Starter ed-fusionary

    (@ed-fusionary)

    Outstanding! there was indeed an option in the theme which restricted search to pages only. I flpped it, and everything worked. Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘relevanssi: blog posts not found’ is closed to new replies.