• Kurt Eye

    (@kurt-freshrrcom)


    Howdy. I’m a fairly experienced WP developer who’s having the worst time figuring this one out…any suggestions appreciated. I’m running out of hair to pull out.

    The search feature on the latest site I’ve built only works properly when there is one search term. If a user searches for two or more words (i.e., a phrase), the search results always turn up what appears to be EVERYTHING in the WP database…including revisions, autosaves, and drafts. In other words:

    A search for “river” returns the expected results. Fine.

    A search for “the river” (which should match some posts) returns EVERYTHING (including drafts, autosaves, and revisions).

    A search for “hsgdg dkjf” (which should match nothing) returns EVERYTHING (including drafts, autosaves, and revisions).

    The site does have a number of plugins installed, some by the client (ugh!), but I fail to see how any of them could affect just the search query without botching other page queries.

    If anyone has any experience with this behavior, or suggestions on how to debug this issue, I’d greatly appreciate it.

Viewing 11 replies - 1 through 11 (of 11 total)
  • I’m experiencing exactly the same behaviour on a new WP site I’m building. Never experienced this before.

    Did you ever find a fix, or identify a plugin that was causing this?

    For info, my installed plugins include:

    – WPFilebase
    – WPMUDev SEO
    – Post Expirator
    – Mingle Forum

    Anything look familiar?

    Cheers
    Marcus

    Thread Starter Kurt Eye

    (@kurt-freshrrcom)

    Marcus,

    I never did find a fix, but I think together we have identified the culprit: WPFilebase. The site I built uses that plugin as well. I’ll do some research and post back what I find; I hope you will do the same.

    Meanwhile, my ad hoc solution was to modify the page query to use only the first word of a search phrase:

    <?php
    if(is_search()) {
       $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
       $search = get_query_var('s');
       $terms = explode(' ',$search);
       $s = $terms[0];
       query_posts("s=$s&paged=$page");
    }
    ?>

    The site in question isn’t very large, and so far no one has complained.

    [:: ducks head, turns off cell phone ringer ::]

    Many thanks, Kurt – I had a feeling it might be to do with WPFilebase…

    I’ll also do some digging and post back with any findings.

    m

    Thread Starter Kurt Eye

    (@kurt-freshrrcom)

    I know where the problem is happening, but I’m not yet sure how to fix it properly. The issue is with the massive SQL “WHERE” clause that WP-Filebase builds in order to include Filebase file attributes in WordPress search results.

    If you don’t care about information about files uploaded via WP-Filebase appearing in your search results, here’s a hack that returns WP search to normal…

    In the file /plugins/wp-filebase/classes/Search.php, change line 41 from this:

    $search_fields = array('name', 'thumbnail', 'display_name', 'description', 'requirement', 'version', 'author', 'language', 'platform', 'license');

    to this:

    $search_fields = array( );

    CAVEAT: Of course, if you ever update the plugin, you’ll need to do this again. Unless the developer fixes it himself.

    Thanks for the workaround – nice work. That will do nicely for now.

    I’ve spotted another problem in WPFilebase, in that I’m also getting a file name repeating on occasion when I’ve embeded them in a Page/Post from WPFilebase. Perhaps the same issue… i.e. WPFilebase showing a revisions of the file from the database? Will clear my revisions from the database to see if that’s the issue there too.

    m

    By the way – WP-Filebase Search issue also seems to be a problem in the WordPress Admin. When I “Search Pages” for a known search term, I often get many repeated entries in the search results.

    Yeah, I’m getting double results in search as well. Hope Fabi will fix his awesome plugin soon!

    Does anyone know if this is being addressed? This happens for us too and I’ve narrowed it down to wp-filebase.

    when i uninstall the plugin, search functionality is restored.

    when it’s installed, it returns all the post/page revisions in multiple term searches.

    oh and the fix above does not work for me.

    @kurt-freshrr.com:

    for this modification:

    <?php
    if(is_search()) {
    $page = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
    $search = get_query_var(‘s’);
    $terms = explode(‘ ‘,$search);
    $s = $terms[0];
    query_posts(“s=$s&paged=$page”);
    }
    ?>

    what page do i modify ?

    For those of you experienced in this, is there a way to disable multi-search?

    Did not want to have that feature on our current theme.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Multi-word Search returns drafts, revisions, auto-saves…everything!’ is closed to new replies.