简体   繁体   中英

Mysql Select Query with match and against issue

This is my code to perform a search

 SELECT d.deal_id,
    d.deal_title,
    d.friendly_url
    FROM wp_deals AS d
   WHERE MATCH (d.deal_title) AGAINST ('Historic China eight day tour' IN BOOLEAN MODE)
   GROUP BY d.deal_id

It works fine.and give 14 results. one of them is

Great Sandy Straits two night Natural Encounters Tour for two with sunset cruise & more. Up to $1,071 off!

But when I search for "with" or "more" it becomes

SELECT d.deal_id,
   d.deal_title,
   d.friendly_url
 FROM wp_deals AS d
WHERE MATCH (d.deal_title) AGAINST ('more' IN BOOLEAN MODE)
GROUP BY d.deal_id


 SELECT d.deal_id,
   d.deal_title,
   d.friendly_url
   FROM wp_deals AS d
   WHERE MATCH (d.deal_title) AGAINST ('with' IN BOOLEAN MODE)
   GROUP BY d.deal_id

and does not give any result although with and more both are their. I am not an expert with this type of search query.

But

When i search with "tour" that is also their it works fine.whats going on their. could not understand as "tour","with" and "more" all contains four letters and also their in title.

You People are Genius..

What you suggest so it will workout.

Thanks in advance.

In Boolean full-text searches the stopword list applies and common words such as “some” or “then”... are stopwords and do not match if present in the search string : http://dev.mysql.com/doc/refman/5.5/en//fulltext-boolean.html

Stopword list : http://dev.mysql.com/doc/refman/5.0/en/fulltext-stopwords.html

The best known solutions are disable the list or add / remove values ​​from it : How to reset stop words in MYSQL?

Also :

SELECT d.deal_id,
   d.deal_title,
   d.friendly_url
FROM 
   wp_deals AS d
WHERE MATCH (d.deal_title) AGAINST ('+more*' IN BOOLEAN MODE)
GROUP BY d.deal_id

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM