PHP + MYSQL multi-keyword + fuzzy search + matching sorting. how can this problem be achieved?-php Tutorial

Source: Internet
Author: User
PHP + MYSQL multi-keyword + fuzzy search + matching sorting. how can this problem be achieved? I have already used MYSQL & nbsp; UNION & nbsp; to achieve one, but the efficiency is too low. please ask the top guys on the forum if there is a better way. Mysqlphp fuzzy search PHP + MYSQL multi-keyword + fuzzy search + matching sorting. how can this problem be achieved?
Mysql union has been used to implement one, but the efficiency is too low. please ask the experts on the forum if there is a better way.

Mysql php fuzzy search sorting


------ Solution --------------------
Since you do not need to calculate the number of occurrences, the combination is not better.
SELECT. 'askid',. 'catid',. 'title',. 'status',. 'addtime',. 'reward ',. 'ancercount', B. 'message'
FROM 'phpcms _ ask 'a left join 'phpcms _ ask_posts 'B ON a. 'askid' = B. 'askid'
WHERE (. status = 3 OR. status = 5) AND B. 'isask '= 1 AND (LOCATE ('China',. 'title')> 0 or locate ('Beijing',. 'title')> 0 or locate ('Tiananmen Square ',. 'title')> 0)

------ Solution --------------------
To calculate the matching degree, you only need
Select sign (LOCATE ('China',. 'title') + sign (LOCATE ('Beijing',. 'title') + sign (LOCATE ('Tiananmen Square ',. 'title') as matching number from...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.