【发布时间】:2020-12-16 17:10:10
【问题描述】:
我使用 sphinx search 在我的 PostgreSQL 数据库中创建索引和搜索数据。
我有两个问题。
-
如果我运行命令
/usr/bin/indexer --config /etc/sphinxsearch/sphinx.conf --rotate --all
我从'show tables;'得到输出
| Index | Type |
|---|---|
| dist_title_de | distributed |
| word_title_de | local |
| word_titlestemmed_de | local |
| rt_title_de | rt |
但是如果我运行命令
/usr/bin/indexer --config /etc/sphinxsearch/sphinx_another_conf_file.conf --rotate --all
然后我在终端上得到相同的输出,但在“显示表;”上没有看到新的索引。似乎索引器中的“--config”选项不起作用,只有正确的名称是 sphinx.conf。这是有问题的,因为如果我想重新索引 sphinxsearch,我必须更改文件 sphinx.conf。
- 第二个问题是否可以在不删除旧索引的情况下“添加”新索引?目前我使用狮身人面像(每天):
- 获取新数据(datasource1、datasource2、...、datasource8)
- Index --rotate --all(索引来自 8 个数据源的数据)
- 搜索一些关于索引的信息
- 写入数据库
但是现在,我想要这样的东西:
- 从 datasource1 获取新数据
- 索引数据源1
- 从 datasource2 获取新数据
- 索引 datasource2(不删除索引 datasource1)
- 在索引数据源 1 中搜索内容
- ....
- 从datasource8获取新数据(不删除索引)
- 索引数据源8 等等
关于“不删除索引”我的意思是,现在如果我使用主题顶部的命令,我会“丢失”我的索引并只获得新的索引(来自 sphinx.conf)。
我的 sphinx.conf(只有 1 个数据源):
source src_title_de
{
type = pgsql
sql_host = #######
sql_user = #######
sql_pass = #######
sql_db = #######
sql_port = 3306 # optional, default is 3306
sql_query = \
SELECT id, group_id, (date_extraction::TIMESTAMP) AS date_extraction, title \
FROM sphinx_test
sql_ranged_throttle = 0
}
index word_title_de
{
source = src_title_de
path = /var/lib/sphinxsearch/data/word_title_de
docinfo = extern
dict = keywords
mlock = 0
morphology = none
stopwords = /var/lib/sphinxsearch/data/stopwords.txt
wordforms = /var/lib/sphinxsearch/data/wordforms_de.txt
min_word_len = 1
}
index word_titlestemmed_de : word_title_de
{
path = /var/lib/sphinxsearch/data/word_titlestemmed_de
morphology = stem_en
}
index dist_title_de
{
type = distributed
local = word_title_de
local = word_titlestemmed_de
agent = localhost:9313:remote1
agent = localhost:9314:remote2,remote3
agent_connect_timeout = 1000
agent_query_timeout = 3000
}
index rt_title_de
{
type = rt
path = /var/lib/sphinxsearch/data/rt_title_de
rt_field = title
rt_field = content
rt_attr_uint = gid
}
indexer
{
mem_limit = 128M
}
searchd
{
listen = 9312:sphinx
listen = 9306:mysql41
log = /var/log/sphinxsearch/searchd.log
query_log = /var/log/sphinxsearch/query.log
read_timeout = 5
client_timeout = 300
max_children = 30
persistent_connections_limit = 30
pid_file = /var/run/sphinxsearch/searchd.pid
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
mva_updates_pool = 1M
max_packet_size = 8M
max_filters = 256
max_filter_values = 4096
max_batch_queries = 32
workers = threads # for RT to work
}
我的 8 个数据源的第二个文件与上面相同,在 'source src_title_de'、'index word_title_de'、'index word_titlestemmed_de'、'index rt_title_de' 上使用 CTRL+C CTRL+V 与另一个国家/地区并更改包含数据的表'sql_query'。
【问题讨论】:
标签: sphinx