Configuration Sphinx搜索多个配置文件导入
如何在Spinx搜索中使用多个配置文件(最好将一个配置文件包含在另一个配置文件中)?我需要它用于不同的环境,因为开发、阶段和生产之间的唯一区别是数据库凭据。有没有一种简单的方法可以实现这一点?在linux上,可以使用动态配置文件 ie配置文件可以由任意解析器执行。因此,配置文件可以是PHP、perl甚至shell脚本Configuration Sphinx搜索多个配置文件导入,configuration,sphinx,Configuration,Sphinx,如何在Spinx搜索中使用多个配置文件(最好将一个配置文件包含在另一个配置文件中)?我需要它用于不同的环境,因为开发、阶段和生产之间的唯一区别是数据库凭据。有没有一种简单的方法可以实现这一点?在linux上,可以使用动态配置文件 ie配置文件可以由任意解析器执行。因此,配置文件可以是PHP、perl甚至shell脚本 更多信息:一个老问题,但仍然值得留下一个答案,以防有帮助 index.conf #!/bin/sh my_function() { cat << EOF sourc
更多信息:一个老问题,但仍然值得留下一个答案,以防有帮助 index.conf
#!/bin/sh
my_function() {
cat << EOF
source source_$1 {
type = csvpipe
csvpipe_delimiter = |
csvpipe_command = cat /input/data_file_$1.txt
csvpipe_field_string = product_name
csvpipe_attr_string = sku
csvpipe_attr_string = manufacturer
csvpipe_attr_uint = on_hand
}
index idx_$1 {
min_infix_len = 3
ignore_chars = U+AD,U+002D,U+00AD,U+002F,U+2044
charset_table = 0..9, A..Z->a..z, a..z
type = plain
source = source_$1
path = /var/lib/manticore/idx_$1
}
EOF
}
while IFS="" read -r p || [ -n "$p" ]
do
my_function $p
done < index_prefixes.txt
将产生以下样品
source source_abc {
type = csvpipe
csvpipe_delimiter = |
csvpipe_command = cat /input/data_file_abc.txt
csvpipe_attr_bigint = dist_id
csvpipe_field_string = product_name
csvpipe_attr_string = sku
csvpipe_attr_string = manufacturer
csvpipe_attr_uint = on_hand
}
index idx_abc {
min_infix_len = 3
ignore_chars = U+AD,U+002D,U+00AD,U+002F,U+2044
charset_table = 0..9, A..Z->a..z, a..z
type = plain
source = source_abc
path = /var/lib/manticore/idx_abc
}
...remaining output removed for brevity...
source source_abc {
type = csvpipe
csvpipe_delimiter = |
csvpipe_command = cat /input/data_file_abc.txt
csvpipe_attr_bigint = dist_id
csvpipe_field_string = product_name
csvpipe_attr_string = sku
csvpipe_attr_string = manufacturer
csvpipe_attr_uint = on_hand
}
index idx_abc {
min_infix_len = 3
ignore_chars = U+AD,U+002D,U+00AD,U+002F,U+2044
charset_table = 0..9, A..Z->a..z, a..z
type = plain
source = source_abc
path = /var/lib/manticore/idx_abc
}
...remaining output removed for brevity...