search

Home  >  Q&A  >  body text

How is the search technology of Meituan Takeout implemented (php)

伊谢尔伦伊谢尔伦2754 days ago508

reply all(4)I'll reply

  • 習慣沉默

    習慣沉默2017-05-16 13:14:53

    Doesn’t php have sphinx and xunsearch?

    reply
    0
  • 为情所困

    为情所困2017-05-16 13:14:53

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

    reply
    0
  • 迷茫

    迷茫2017-05-16 13:14:53

    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

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-05-16 13:14:53

    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;

    reply
    0
  • Cancelreply