Query problem of mysql word Segmentation

customer input official number can match Park No. 1 this building
customer input Park No. 1 can also match Park No. 1
customer input Park No. 1 can also match this building
excuse me how can I do this kind of search? I use the website built by php+mysql, do I need to open mysql full-text search, but take a look. Full-text search doesn"t seem to completely solve the problem I"m talking about

Apr.25,2022

can be implemented in elastic search, but you can't solve this requirement with mysql. If the database is small, you can put all the real estate names into the local cache, and then do index search.


this certainly has nothing to do with mysql.
requires you to do manual conversion at the back end. For example, convert the one and one passed from the front end to one and then call mysql


code to convert the search keywords and then query it. The database is not so smart.


the latter two, full-text search and Chinese word segmentation should be done. The first one is estimated to be able to insinuate


, which is not the category of mysql, but what your business logic needs to do. In fact, you can add a keyword list field to the real estate table. For example, "Park one" corresponding to the search keyword list "official account, Park 1, Park". No, no, no. no, no, no. When searching, give priority to matching the keyword list.


if you only want to use Mysql and don't plan to connect things like Lucene or Sphinx, it's not impossible. First, you need a word participle (binary participles don't need a thesaurus), and then connect the thesaurus into a LIKE condition. It makes sense to enable full-text search to be efficient with a small amount of data. However, the problem of this search is solved, but it cannot be sorted by matching degree. More than a decade ago (like 05, 06) I wrote a simple search with Perl, word segmentation using left-to-maximum matching algorithm, data storage using Mysql, but also to enter the article segmentation, and then stored in the associated word list; the whole search process does not need LIKE, only use IN, and can calculate a simple matching degree, but I can not find the code.

now I even build the "database" on Lucene, and I'm too lazy to bother with it.


this is not the category of mysql

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b38d9d-2b8c4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b38d9d-2b8c4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?