Sphinx vs. MySql - Search through list of friends (efficiency/speed)

前端 未结 4 1581
礼貌的吻别
礼貌的吻别 2021-02-19 03:54

I\'m porting my application searches over to Sphinx from MySQL and am having a hard time figuring this one out, or if it even needs to be ported at all (I really want to know if

4条回答
  •  滥情空心
    2021-02-19 04:21

    Take a look at the solution I propose here: https://stackoverflow.com/a/22531268/543814

    Your friend names are probably short, and your query looks simple enough. You can probably afford to store all suffixes, perhaps in a separate table, pointing back to the original table to get the full name.

    This would give you fast infix search at the cost of a little bit more storage space.

    Furthermore, to avoid finding 'Marianne' when searching for 'Ann', consider:

    • Using case-sensitive search. (Fragile; may break if your users enter their names or their search queries with incorrect capitalization.)
    • After the query, filtering your search results further, requiring word boundaries around the search term (e.g. regex \bAnn\b).

提交回复
热议问题