Making WordPress.org

#6934 closed defect (bug) (fixed)

Search not returning obvious matches

Reported by: topher1kenobe's profile topher1kenobe Owned by: otto42's profile Otto42
Milestone: Priority: normal
Component: Photo Directory Keywords:
Cc:

Description

This search: https://wordpress.org/photos/?s=peanut+butter

does not return this image: https://wordpress.org/photos/photo/642642c1de/

despite the search terms being exactly represented in the alt text.

Change History (4)

#1 @Otto42
12 months ago

This comes from the limit_partial_matching function. I'm not entirely certain what the purpose of this regular expression is, but something about it doesn't look right.

https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/search.php#L95

#3 @Otto42
12 months ago

The relevant portion of the SQL:

OR (post_content LIKE 'peanut%') ...
OR (post_content LIKE 'butter%') ...

And so on. Basically, it will only match peanut or butter at the start of the content. Probably not what was intended, so it's unlikely that that fix worked.

#4 @Otto42
12 months ago

  • Owner set to Otto42
  • Resolution set to fixed
  • Status changed from new to closed

In 12543:

Photo directory: Switch limit matching to use a regular expression for the query. The extra backslashes are because of the ridiculous escaping necessary for both PHP and mySQL. Fixes #6934. Related #6569

Note: See TracTickets for help on using tickets.