Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#18522 closed defect (bug) (worksforme)

Search using double quotes stopped working at v3.1

Reported by: kizora's profile kizora Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: General Keywords:
Focuses: Cc:

Description

Hi,

While doing incremental upgrades from WP 3.0.2 I noticed the search function isn’t working properly when I get to v3.1. I disabled plugins while upgrading etc. following the guide at http://codex.wordpress.org/Upgrading_WordPress_Extended. Search is fine at v3.0.6.

Entering a search string of “Swimming Pool” (with quotes): With WP 3.0.6, this displayed all posts containing the text string swimming pool; With WP 3.1, no posts are returned. Double quotes are for multiple word exact matching. One word searches are fine. The problem only occurs when using double quotes.

db version changed from 15477 (3.0.6) to 17056 (3.1). Did something change in 17056 to affect the search?

Thanks, Chris

Change History (24)

#1 @dd32
13 years ago

This sounds like #17200 to me.. although that doesnt have a outcome yet.

This comment from that ticket is relevant:

Can you install the "Debug Bar" plugin & add define('SAVEQUERIES', true); to your wp-config.php file; Once that's done, Perform the search and click the Debug button in the Admin Bar, if you can copy the queries made to check that nothing is being excluded?

The full set of SQL isn't really needed, just the "Query SQL" section to start with.

#2 in reply to: ↑ description @SergeyBiryukov
13 years ago

  • Keywords reporter-feedback added

Replying to kizora:

Entering a search string of “Swimming Pool” (with quotes)

To be clear, do you use “curly” or "simple" quotes?

#3 @kizora
13 years ago

Sergey - I'm using simple " quotes

dd32 - I've reverted back to 3.0.6 for now. What sort of overhead does the "debug bar" plugin impose on a (live) website?

#4 @dd32
13 years ago

dd32 - I've reverted back to 3.0.6 for now. What sort of overhead does the "debug bar" plugin impose on a (live) website?

In the 60 seconds you need to use it, Next to none, Since it only runs for logged in users, it shouldn't affect standard users browsing the site.

Since it's a live server, You don't need to add the SAVEQUERIES definition, that's the one thing that may cause extra load.

#5 @kizora
13 years ago

  • Keywords reporter-feedback removed

Ok, I've had a practice with the debug bar on a localhost version of the website.

The query used is

SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts WHERE 1=1 AND (((wp_posts.post_title LIKE '%Swimming Pool%') OR (wp_posts.post_content LIKE '%Swimming Pool%'))) AND wp_posts.post_type IN ('post', 'page', 'attachment') AND (wp_posts.post_status = 'publish' OR wp_posts.post_author = 1 AND wp_posts.post_status = 'private') ORDER BY wp_posts.post_date DESC LIMIT 0, 10

and that finds 10 rows.

I'll try and get up early tomorrow and set the live website back to v3.1 and install and run the debug bar on the search and see what sql it runs.

Just to confirm - I don't need to define savequeries in wp-config?

Cheers
Chris

#6 @dd32
13 years ago

Just to confirm - I don't need to define savequeries in wp-config?

Correct, You don't need it.

#7 @GaryJ
13 years ago

Just tested by searching with a double-quoted string on a standard WP 3.2.1 install, and the posts appeared fine. Is there a reason you're wanting to run 3.1 instead of the latest stable version?

#8 @kizora
13 years ago

I originally auto upgraded from 3.0.2 to the then latest wp3.1.3. When the search problem appeared, I went back to 3.0.2 to do incremental upgrades to find out which version caused the problem - 3.1.
I'm reluctant to do another auto update to 3.2.1 after the problems I've had going from 3.0.2 to 3.1.
Hopefully, will have more info after I run debug against 3.1

#9 @SergeyBiryukov
13 years ago

I also tried searching a double-quoted string on WP 3.1 and couldn't reproduce the issue, so more info would be great.

#10 @kizora
13 years ago

Have just run debug in the live website set to wp3.1. The query used is (identical)

Query Arguments:s=%5C%22Swimming+Pool%5C%22

SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts WHERE 1=1 AND (((wp_posts.post_title LIKE '%Swimming Pool%') OR (wp_posts.post_content LIKE '%Swimming Pool%'))) AND wp_posts.post_type IN ('post', 'page', 'attachment') AND (wp_posts.post_status = 'publish' OR wp_posts.post_author = 1 AND wp_posts.post_status = 'private') ORDER BY wp_posts.post_date DESC LIMIT 0, 10

and that finds no rows!

I ran the query in live phpMyAdmin and it finds 10 rows - confused!

debug stats show:-
the localhost version = | PHP 5.3.1 | DB 5.1.41 | Mem. 17,979,896 bytes
the live version = | PHP 5.2.14 | DB 5.0.91 | Mem. 22,955,176 bytes

could the different PHP / DB versions have an effect?

#11 @kizora
13 years ago

anybody help please ....

Thanks
Chris

#12 @dd32
13 years ago

Sounds like it might be an incompatible plugin or caching backend playing up to me.

#13 @kizora
13 years ago

Hi dd32,

Disabling all the plugins has no effect and I've cleared the browser cache.

What's "caching backend" ?

Cheers
Chris

#14 @dd32
13 years ago

What's "caching backend" ?

If you don't know what it is, chances are, you're not using it, but the Caching backend I was referring to was an Object cache, which you can check for, by seeing if you have a 'object-cache.php' file in your wp-content folder.

#15 @kizora
13 years ago

The only file I could find is in the debug bar plugin (you suggested I try) in wp-content/plugins/debug-bar/panels, but that's called class-debug-bar-object-cache.php and the plugin is disabled.

As it's the same code and query running on the localhost and live site, what other environmental areas may be causing this?

Thanks
Chris

#16 @SergeyBiryukov
13 years ago

Could you by any chance check if the issue still exists in WP 3.2.1?

If you don't want to upgrade the live site, I'd suggest installing WP 3.2.1 in a subdirectory just to test.

#17 @kizora
13 years ago

Yes, I was thinking of trying that.

Am away for a few days, but will do it when I get back.

#18 @kizora
13 years ago

Updated the live site to WP 3.2.1 and the search still doesn't work properly, yet it works properly in my localhost version running 3.2.1.

#19 @SergeyBiryukov
13 years ago

I think I have an idea.

If you're using pretty permalinks and search base (http://example.com/search/"Swimming+Pool"), that might be a duplicate of #13961.

Try http://example.com/?s="Swimming+Pool" and/or the patch from #13961.

#20 @SergeyBiryukov
13 years ago

There's a plugin based on that patch, it'll probably make testing easier.

#21 @kizora
13 years ago

I do use pretty permalinks but not sure about the rest of your response above.

If I search for "swimming pool" I get this page returned http://thebeautifulhousecompany.com/?s=%22swimming+pool%22&et-cat=0&et_searchform_submit=et_search_proccess

Is the problem the search is looking for %22swimming pool%22 rather than swimming pool? Even though it works in localhost?

So, I can either add "if ( empty( $_GETs? ) ) $qs? = urldecode($qs?); " to query.php or try the plugin?

Thanks for your help
Chris

#22 @SergeyBiryukov
13 years ago

Looks like something else is going on here, which makes my assumption irrelevant.

At this point, I'd suggest trying the support forums to find out if it's a configuration/environment problem or a bug in the WordPress core: http://wordpress.org/support/.

#23 @johnbillion
13 years ago

  • Resolution set to worksforme
  • Status changed from new to closed

Closing as no-one else is able to reproduce, and a search for "swimming pool" on the reporter's site (see link above) is currently working as expected.

#24 @helenyhou
13 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.