[wp-trac] Re: [WordPress Trac] #1435: Pages should be searched

WordPress Trac wp-trac at lists.automattic.com
Thu Oct 5 13:41:51 GMT 2006


#1435: Pages should be searched
----------------------------------------------+-----------------------------
 Reporter:  markjaquith                       |        Owner:  anonymous
     Type:  enhancement                       |       Status:  new      
 Priority:  normal                            |    Milestone:  2.2      
Component:  General                           |      Version:  1.5.1.1  
 Severity:  normal                            |   Resolution:           
 Keywords:  search pages static dev-feedback  |  
----------------------------------------------+-----------------------------
Comment (by majelbstoat):

 If there are fulltext indices on post_content and post_title, you can do a
 MySQL MATCH() query:

 {{{
 SELECT * FROM wp_posts WHERE MATCH(post_content, post_title) AGAINST('my
 string to search for');
 }}}

 which returns in order of relevance descending (best first), or to do the
 same, but also get the relevance (so you can generate 98% match etc):

 {{{
 SELECT p.*, MATCH (post_title, post_content) AGAINST ('My search string')
 AS score FROM wp_posts AS p WHERE MATCH (post_title, post_content) AGAINST
 ('My search string');
 }}}

 All this should be valid for MySQL 3.23.23+

 More info at:

 http://dev.mysql.com/doc/refman/4.1/en/fulltext-search.html

-- 
Ticket URL: <http://trac.wordpress.org/ticket/1435>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list