How is the search technology of Meituan Takeout implemented (php)
伊谢尔伦
伊谢尔伦 2017-05-16 13:12:53
0
4
551

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(4)
習慣沉默

Doesn’t php have sphinx and xunsearch?

为情所困

Try the elasticsearch search engine, which supports word segmentation, full-text search, and can also be sorted based on similarity

迷茫

Either you have your own search department to develop it yourself, or you use some of the popular open source search engines, such as solr and elasticsearch

淡淡烟草味

Let me tell you my idea: convert Chinese characters into pinyin and then perform full-text search.

// PHP利用ICU扩展intl实现汉字转拼音
echo transliterator_transliterate('Any-Latin; Latin-ASCII; Lower()', '德克士'); //de ke shi
echo transliterator_transliterate('Any-Latin; Latin-ASCII; Lower()', '得克'); //de ke

// 假设name字段内容为"德克士",则name_fts字段内容为"de ke shi".
// MySQL全文检索字段name_fts中同时包含"得克"关键字de和ke的商店记录.
// 所以 name_fts 中包含de和ke的店铺都能显示出来.
SELECT name FROM store 
WHERE MATCH(name_fts) AGAINST('+de +ke' IN BOOLEAN MODE)
ORDER BY id DESC LIMIT 5;
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template