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 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 MATLAB中streamslice问题
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序