这是我的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. Alex 2. Alen 3. George 4. A 5. G
当我尝试搜索简单的1字符字符串"A“时,我得到Alen / Alex /A,依此类推。
如何根据字符串长度进行搜索,以便按正确的顺序显示它们,如:A/ Alen / Alex ...
我还得到“警告:索引'FULL':无形态,index_exact_words=1没有效果,忽略”
诚挚的问候
发布于 2012-04-04 23:06:32
使用序数字段( str2ordinal ),执行常规搜索,但修改排序模式:切换到扩展模式,并使用像$sphinx_client->SetSortMode(SPH_SORT_EXTENDED,'@weight desc,myordinal asc‘这样的组合;
https://stackoverflow.com/questions/9995344
复制相似问题