我尝试使用Google搜索,但我不确定我的术语是否错误,或者我对如何使用Sphinx有错误的想法。
我需要一些帮助,使用像sphinx之类的东西从数据库创建和搜索表的索引。我正在运行Ubuntu 14.04 LTS。
我的sphinx配置文件如下所示:
source db1
{
sql_host = localhost
sql_user = user1
sql_pass = pswd123
sql_db = db1
sql_port = 3306
type = mysql
sql_query = SELECT * FROM MetaData;
}
index myidx
{
source = mureinome
path = /var/lib/sphinxsearch/data/myidx
docinfo = extern
# Added after suggestion from Mihai
min_stemming_len = 1
min_word_len = 1
dict = keywords
}
indexer
{
mem_limit = 1000M
write_buffer = 50M
}
searchd
{
listen = 9312
listen = 9306:mysql41
pid_file = /var/run/sphinxsearch/searchd.pid
binlog_path = /var/lib/sphinxsearch/data
}
索引我运行的表:
root@M4:/var/lib/sphinxsearch# indexer myidx --rotate
Sphinx 2.2.10-id64-release (2c212e0)
Copyright (c) 2001-2015, Andrew Aksyonoff
Copyright (c) 2008-2015, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file '/etc/sphinxsearch/sphinx.conf'...
indexing index 'myidx'...
WARNING: Attribute count is 0: switching to none docinfo
collected 1 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 1 docs, 459 bytes
total 0.005 sec, 80286 bytes/sec, 174.91 docs/sec
total 3 reads, 0.000 sec, 0.6 kb/call avg, 0.0 msec/call avg
total 9 writes, 0.000 sec, 0.6 kb/call avg, 0.0 msec/call avg
rotating indices: successfully sent SIGHUP to searchd (pid=2444).
但是当我尝试搜索索引时,我得到一个空结果:
SELECT * FROM myidx WHERE MATCH('FC') LIMIT 0,5;
Empty set (0.00 sec)
在MySQL中表中的一个列如下所示:
mysql> select SampleName from MetaData;
+-----------------+
| SampleName |
+-----------------+
| FCPG1048_S1S2S3 |
+-----------------+
1 row in set (0.00 sec)
我是否将表索引错误,或者我搜索索引错误了?任何帮助是极大的赞赏。
答案 0 :(得分:1)
要启用部分字匹配,需要使用min_prefix_len
或min_infix_len
http://sphinxsearch.com/docs/current.html#conf-min-prefix-len
完成后可以在查询中使用*。或者使用expand_keywords
自动有效地执行此操作。