我试过用google搜索这个,但我不确定我的术语是错误的还是我对如何使用狮身人面像有错误的想法。使用狮身人面像来索引MySQL表
我需要一些帮助,使用sphinx之类的东西来创建和搜索数据库中表的索引。我正在运行Ubuntu 14.04 LTS。
我的狮身人面像的配置文件看起来像这样:
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
}
要索引的表我运行:
[email protected]:/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)
我是索引表的错误还是索引我索引错了?任何帮助是极大的赞赏。
对Sphinx不太了解,但在Mysql做FULLTEXT搜索时,有一个最小字长,请参见'配置最小和最大字长度'一节http://dev.mysql.com/doc/refman/5.6 /en/fulltext-fine-tuning.html我不知道这是如何转化为狮身人面像。只需用更长的单词进行搜索即可测试 – Mihai
现在,您可以这么说了!搜索整个字符串的作品。 –
还要注意停用词表,被忽略的词很常见https://dev.mysql.com/doc/refman/5.6/en/fulltext-stopwords.html – Mihai