dream198731 2014-09-12 15:41
浏览 69
已采纳

如何使Sphinx更松散地匹配?

I'm using the default settings in the PHP library and am using the latest version of Sphinx (2.2.3). I need to make search results match more loosely. Here are my index settings in sphinx.conf:

morphology     = stem_en
min_word_len   = 1
min_prefix_len = 1
prefix_fields = name
expand_keywords = 1

If I search for Nexus 7 on my website then a ton of search results show up (the Nexus 7 tablets and then lots of accessories for it), but if I search for ASUS New Nexus 7 FHD Tablet, Black then only the tablets show up (none of the accessories). It's like Sphinx isn't showing the accessories because they don't contain all of the keywords in the search.

How can I make Sphinx match items more "loosely" so that items that don't match exactly still show up?

  • 写回答

2条回答 默认 最新

  • dqhr76378 2014-09-12 16:19
    关注

    Using Quorum Syntax, is the way to have control over this,

    http://sphinxsearch.com/docs/current.html#extended-syntax

    eg

    $terms = '"'.$client->EscapeQuery($_POST['terms']).'"/0.7';
    

    That way you can control exactly now many words are needed. - eg that 70% of the words in that example. Can change it the exact ratio to taste - or use a whole number of words ef

    $terms = '"'.$client->EscapeQuery($_POST['terms']).'"/3';
    

    requires three words.

    Better than match any would allow, which would only require one word. In the example all documents even with just '7' matching would be included.


    But to be clear there is no 'magic' solution, that makes perfect 'fuzzy' matching. It's always based on comprimises to make it look like the search is inteligent. You may have to do a lot of tweaking to get acceptable results - and maybe use a combination of techniques.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错