情况是这样的,我用 sphinx 创建了本地索引。
C:\Users\alex321>"D:\sphinx\bin\indexer.exe" --config "D:\sphinx\bin\sphinx.conf" --all
Sphinx 3.0.2 (commit 2592786)
Copyright (c) 2001-2018, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (
http://sphinxsearch.com)
using config file 'D:\sphinx\bin\sphinx.conf'...
indexing index 'test1'...
collected 3547 docs, 2.9 MB
sorted 0.2 Mhits, 100.0% done
total 3547 docs, 2.943 Mb
total 0.2 sec, 18.50 Mb/sec, 22302 docs/sec
skipping non-plain index 'testrt'...
然后,启动 searchd
C:\Users\alex321>"D:\sphinx\bin\searchd.exe" --config "D:\sphinx\bin\sphinx.conf"
Sphinx 3.0.2 (commit 2592786)
Copyright (c) 2001-2018, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (
http://sphinxsearch.com)
listening on all interfaces, port=9312
listening on all interfaces, port=9306
WARNING: No extra index definitions found in data folder
accepting connections
prereading 0 indexes
prereaded 0 indexes in 0.001 sec
query error: unknown local index 'test1' in search request
query error: unknown local index 'test1' in search request
实际看到 data 目录下是有 test1 开头的多个文件的。
test1.sha
test1.spa
test1.spd
test1.spe
test1.sph
test1.spi
test1.spj
test1.spk
test1.spp
然后,sphinx.conf 文件是直接拿 etc 下的 mini 进行修改的。
#
# Minimal Sphinx configuration sample (clean, simple, functional)
#
source src1
{
type = mysql
sql_host = localhost
sql_user = test
sql_pass = test
sql_db = test
sql_port = 3306 # optional, default is 3306
sql_query = 查询语句
sql_attr_uint = id
sql_attr_timestamp = time
sql_query_pre = SET NAMES utf8
}
index test1
{
source = src1
path = D:\sphinx\data\test1
}
index testrt
{
type = rt
rt_mem_limit = 128M
path = D:\sphinx\data\testrt
rt_field = title
rt_field = content
rt_attr_uint = gid
}
indexer
{
mem_limit = 128M
}
searchd
{
listen = 9312
listen = 9306:mysql41
log = D:\sphinx\log\searchd.log
query_log = log/query.log
read_timeout = 5
max_children = 30
pid_file = D:\sphinx\log\searchd.pid
seamless_rotate = 1
preopen_indexes= 1
unlink_old = 1
workers = threads # for RT to work
binlog_path = data
}
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
https://www.v2ex.com/t/434329
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.