【问题标题】:Sphinxsearch index min_stemming_lenSphinxsearch 索引 min_stemming_len
【发布时间】:2012-04-03 14:27:53
【问题描述】:

这是我的 sphinx 搜索配置(sphinxsearch_0.9.9-6_amd64):

index FULL
{
    charset_type            =       utf-8
    source                  =       FULL
    path                    =       /var/sphinx/data/Full
    docinfo                 =       extern
    mlock                   =       0
    min_stemming_len        =       1
    min_prefix_len          =       1
    min_word_len            =       1
    html_strip              =       1
    index_exact_words       =       1

}

searchd
{
    listen                  =       192.168.2.3
    log                     =       /var/log/sphinxsearch/searchd.log
    query_log               =       /var/log/sphinxsearch/query.log
    read_timeout            =       3
    client_timeout          =       60
    max_children            =       30
    pid_file                =       /var/run/searchd.pid
    max_matches             =       1000
    seamless_rotate         =       1
    preopen_indexes         =       0
    unlink_old              =       1
    mva_updates_pool        =       1M
    max_packet_size         =       8M
    max_filters             =       256
    max_filter_values       =       4096
}

我使用php作为客户端

$sphinx_client->SetServer('localhost', 9312);
$sphinx_client->SetConnectTimeout(1);
$sphinx_client->SetArrayResult(true);
$sphinx_client->setRankingMode(SPH_RANK_WORDCOUNT);
$sphinx_client->SetMatchMode(SPH_MATCH_EXTENDED2);
if ($mode == 'all') {
$sphinx_client->SetSortMode(SPH_SORT_RELEVANCE, 'category');
} else {
$sphinx_client->setFilter('category', array($this->_filter_category), FALSE);
}
$sphinx_client->SetLimits(0, $this->_limit);
$results = $sphinx_client->Query('"^'.$query.'$"', 'FULL');

例如,我在索引中有这些名称: 1.亚历克斯 2.艾伦 3.乔治 4.一个 5.G

::: 当我尝试搜索简单的 1 字符字符串“A”时,我得到 Alen / Alex / A 等等。

如何根据字符串长度进行搜索,以便以正确的顺序显示它们,例如: A / Alen / Alex ...

我还收到“警告:索引 'FULL':没有形态,index_exact_words=1 没有效果,忽略”

最好的问候

【问题讨论】:

    标签: search sphinx


    【解决方案1】:

    使用序数字段(str2ordinal),进行正常搜索,但修改排序模式:切换到扩展模式并使用 $sphinx_client->SetSortMode(SPH_SORT_EXTENDED, '@weight desc , myordinal asc');

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-15
      • 1970-01-01
      • 1970-01-01
      • 2016-02-14
      相关资源
      最近更新 更多