[wp-trac] [WordPress Trac] #33988: New param for search in WP Query

WordPress Trac noreply at wordpress.org
Sat Oct 3 05:20:46 UTC 2015


#33988: New param for search in WP Query
------------------------------+------------------
 Reporter:  sebastian.pisula  |       Owner:
     Type:  enhancement       |      Status:  new
 Priority:  normal            |   Milestone:  4.4
Component:  Query             |     Version:
 Severity:  normal            |  Resolution:
 Keywords:  has-patch         |     Focuses:
------------------------------+------------------
Changes (by boonebgorges):

 * keywords:  needs-unit-tests has-patch => has-patch
 * milestone:  Future Release => 4.4


Comment:

 Thanks, akibjorklund! Looks like it ended up being easier than I thought
 it'd be. [attachment:33988.diff] cleans up the first part of your patch,
 and adds a unit test.

 I think that your changes in `parse_search_order()` aren't quite right.
 `parse_search_order()` converts `s` to a couple of `ORDER BY` clauses: one
 for an exact match in the title, a few for combinations of single words in
 the title, and one for an exact match in the content. We don't want any
 exact matches, though. If you search `foo -bar baz`, you don't want to
 match a post that contains the sentence `foo -bar baz`. And you also don't
 want to match a post that has `foo baz`, which is what your patch will do.
 I think the right answer in these cases is to skip the sentence matches,
 but to keep the single word matches (negative terms already having been
 filtered out by this point). Does this seem right to others?

 This is a neat little improvement. Let's try to do it for 4.4.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33988#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list