0
我需要使用獅身人面像創建短語搜索。我使用這個配置文件如何使用獅身人面像做短語搜索
source sphinx_search
{
type = mysql
# some straightforward parameters for SQL source types
sql_host = localhost
sql_user = root
sql_pass = root
sql_db = mydatabase
sql_port = 3306
sql_query = \
SELECT userId, usertype_id, searchdata from tbl_user;
#sql_attr_uint = userId
sql_attr_uint = usertype_id
#document info query, ONLY for CLI search (ie. testing and debugging)
#optional, default is empty
#must contain $id macro and must fetch the document by that id
sql_query_info = SELECT * FROM tbl_user WHERE userId=$id;
}
index sphinx_search {
source = sphinx_search
path = /var/lib/sphinx/sphinx_search
morphology = stem_en
min_stemming_len = 4
stopwords = /var/data/sphinx/stopwords.txt
min_word_len = 3
min_prefix_len = 3
min_infix_len = 0
enable_star = 1
phrase_boundary = ., ?, !, U+2026 # horizontal ellipsis
phrase_boundary_step = 100
html_strip = 1
}
indexer {
mem_limit = 256M
#mem_limit = 128M
max_xmlpipe2_field = 16M
}
searchd {
compat_sphinxql_magics = 0
listen = 9312
listen = 9306:mysql41
log = /var/log/sphinx/searchd.log
query_log = /var/log/sphinx/query.log
read_timeout = 5
max_children = 30
pid_file = /var/run/sphinx/searchd.pid
max_matches = 10000
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
workers = threads # for RT to work
binlog_path = /var/data/
}
創建我的索引。如果我試圖尋找「水污染」字
搜索結果將顯示這樣
words:
1. 'water': 10554 documents, 37143 hits
2. 'pollut': 1902 documents, 9657 hits
第一個問題是它沒有采取那「污染」一詞完全取而代之的是其採取「污染」。
第二個問題是它沒有搜索那個完整的單詞。即使我搜索
「水污染」 這樣子。
第三個問題我無法使用userId對結果進行排序。如果我嘗試添加
sql_attr_uint =用戶id
它不是索引正確。
任何機構都可以幫助我解決這些問題。請幫幫我。
請顯示搜索請求的代碼。 – 2012-07-17 06:22:11