Php 变音搜索+;wilcard搜索:某些查询字符串没有结果

Php 变音搜索+;wilcard搜索:某些查询字符串没有结果,php,mysql,sphinx,Php,Mysql,Sphinx,我一直在尝试实现一个搜索查询建议功能,该功能还可以检测 拼写错误的单词(使用变音词法)。我在一定程度上做到了这一点 但是,问题是某些查询字符串返回空 结果,当他们不应该的时候。例如,请参见此示例: 已编制索引的搜索列表: [“克隆三星galaxy s5”, “三星galaxy ace 4gb”, “三星galaxy core i8262电池”, “三星galaxy grand duos高级版”, “三星galaxy grand prime g530”, “三星银河k3”, “三星galaxy

我一直在尝试实现一个搜索查询建议功能,该功能还可以检测 拼写错误的单词(使用变音词法)。我在一定程度上做到了这一点 但是,问题是某些查询字符串返回空 结果,当他们不应该的时候。例如,请参见此示例:

已编制索引的搜索列表:


[“克隆三星galaxy s5”,
“三星galaxy ace 4gb”,
“三星galaxy core i8262电池”,
“三星galaxy grand duos高级版”,
“三星galaxy grand prime g530”,
“三星银河k3”,
“三星galaxy note 3红色”,
“三星galaxy note pro 12.2 lte黑色”,
“三星galaxy note pro 12.2 p905 lte白色”,
“三星galaxy s duos 2 s7582”,
“三星galaxy s4粉色暮色”,
“三星galaxy s5 2g”,
“三星galaxy s5 32gb”,
“三星galaxy s5 air shuffle”,
“三星galaxy s5克隆”,
“三星galaxy s5克隆韩国”,
“三星galaxy s5克隆韩国规格”,
“三星galaxy s5双核”,
“三星galaxy s5双核”,
“三星galaxy s5韩国克隆规格”]

为什么“三星galax”和“三星ga”有结果而“三星gala”没有。我没有实现任何类型的stopword控件,所以这不是问题所在。我肯定我的索引有问题

以下是sphinx.conf文件中的相关索引:

   index suggestions {

            source = suggestions

            path = /var/www/acme/maniac/sphinx/data/suggestions

            morphology = metaphone

            min_word_len = 3

            min_infix_len = 2
    }
顺便说一句,我是通过php客户端来实现的。下面是执行 斯芬克斯搜索:

public function getKeywordSuggestions($queryString)
{
            $this->sphinxClient->SetMatchMode('SPH_MATCH_ANY');
            $this->sphinxClient->SetFieldWeights([
                    'keywords' => 50,
            ]);

            $this->sphinxClient->SetSortMode(SPH_SORT_RELEVANCE);
            $this->sphinxClient->AddQuery($queryString, 'suggestions');
            $suggestionLimit = 10;
            $this->sphinxClient->setLimits(0, $suggestionLimit, $suggestionLimit);

            $sphinxResult = $this->sphinxClient->RunQueries();
            /**
              * do some of my other mojo
              */
            return $result;
}
你知道为什么会这样吗


编辑:sphinx版本是2.2.1

就mysql问题而言,我只能在看到表的结构和针对表的实际查询时提供帮助。您看到的“mysql问题”是什么?我看不出任何关于mysql的问题,这纯粹是斯芬克斯的问题。是的。sphinx抽象了表索引和全文搜索。没有直接的数据库交互。
public function getKeywordSuggestions($queryString)
{
            $this->sphinxClient->SetMatchMode('SPH_MATCH_ANY');
            $this->sphinxClient->SetFieldWeights([
                    'keywords' => 50,
            ]);

            $this->sphinxClient->SetSortMode(SPH_SORT_RELEVANCE);
            $this->sphinxClient->AddQuery($queryString, 'suggestions');
            $suggestionLimit = 10;
            $this->sphinxClient->setLimits(0, $suggestionLimit, $suggestionLimit);

            $sphinxResult = $this->sphinxClient->RunQueries();
            /**
              * do some of my other mojo
              */
            return $result;
}