search

Home  >  Q&A  >  body text

php - mysql fuzzy search problem

Please tell me how to match the following keywords

For example, the database storage characters are: sfsdf4-1bbsdfsd;

The user inputs 41bb, 4 1bb, and this string can also be matched

How to do this?
Thanks

为情所困为情所困2785 days ago789

reply all(6)I'll reply

  • 世界只因有你

    世界只因有你2017-05-27 17:40:56

    What you need is not mysql fuzzy search.
    Requires search engine support.

    reply
    0
  • PHP中文网

    PHP中文网2017-05-27 17:40:56

    Create a new field to store the string after removing the special characters that need to be ignored, such as: sfsdf41bbsdfsd. When querying, perform the same operation on the keywords and use the new field to match

    reply
    0
  • ringa_lee

    ringa_lee2017-05-27 17:40:56

    MySQL supports regular expression search, such as
    SELECT name FROM person_tbl WHERE name REGEXP '^[aeiou]|ok$';

    reply
    0
  • 怪我咯

    怪我咯2017-05-27 17:40:56

    I think we should first process the data submitted by the user, divide the data submitted by the user with space dividing lines, form an array, and then use the data in this array to perform fuzzy query, and then retrieve the same data. . . But when a large number of users query in this way, I think your system will be slowed down very slowly, so it is not recommended to use this design pattern

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-27 17:40:56

    The title question is set to word segmentation search. Direct fuzzy search cannot match the results. Using regular expression search is too inefficient and is not recommended. Moreover, there are too many scenarios. If you develop and implement it yourself, it will be difficult to consider them all. .
    It is recommended to use a search engine. Sphinx is very easy to use and supports mysql very well.
    The subject of the question has a php tag. If you often use php development, Xunsearch is also good, http://www.xunsearch .com/ Developed by Chinese, the documents are all in Chinese and very convenient to use.

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-27 17:40:56

    Use a search engine, this is what they do professionally

    reply
    0
  • Cancelreply