[wp-trac] [WordPress Trac] #39717: Search_terms_count includes stopwords

WordPress Trac noreply at wordpress.org
Mon Jan 30 19:47:06 UTC 2017


#39717: Search_terms_count includes stopwords
----------------------------------------+----------------------
 Reporter:  msaari                      |       Owner:
     Type:  defect (bug)                |      Status:  closed
 Priority:  normal                      |   Milestone:
Component:  Query                       |     Version:
 Severity:  normal                      |  Resolution:  wontfix
 Keywords:  needs-unit-tests has-patch  |     Focuses:
----------------------------------------+----------------------
Changes (by boonebgorges):

 * status:  new => closed
 * resolution:   => wontfix
 * milestone:  4.8 =>


Comment:

 After reviewing this a bit more, I think I disagree with my earlier self.
 'search_terms_count' is used in WP to determine whether an exact-match
 search ordering should take place. That is: If you search for "call of the
 wild", you'd expect "of" and "the" to be ignored for the general search,
 but you'd also expect exact matches of "call of the wild" in the title or
 content to push the corresponding posts to the top. This exact-match
 ordering requires that 'search_terms_count' reflect the count of the raw
 terms passed to `'s'`, otherwise search phrases with only a single non-
 stopword ("call of the") will not have exact-match ordering applied.

 For this reason, I think we need to mark wontfix. If your plugin needs
 access to the count of non-stopwords, you can do `count( $q->get(
 'search_terms' ) )`.

 Thanks again for the ticket.

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


More information about the wp-trac mailing list