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 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?