Skip to content

Instantly share code, notes, and snippets.

@Tkachenko-Ivan
Last active February 14, 2023 21:25
Show Gist options
  • Save Tkachenko-Ivan/9c8f8b5f98c80f902905b618878486ad to your computer and use it in GitHub Desktop.
Save Tkachenko-Ivan/9c8f8b5f98c80f902905b618878486ad to your computer and use it in GitHub Desktop.
Пример конфигурирования Manticore Search для поиска в реальном времени
version: '3.1'
services:
db:
image: postgres
restart: always
environment:
POSTGRES_DB: searchdb
POSTGRES_USER: searchuser
POSTGRES_PASSWORD: search
ports:
- 5432:5432
manticore:
container_name: manticore
image: manticoresearch/manticore
restart: always
ports:
- 127.0.0.1:9306:9306
- 127.0.0.1:9308:9308
ulimits:
nproc: 65535
nofile:
soft: 65535
hard: 65535
memlock:
soft: -1
hard: -1
volumes:
- ./manticore:/var/lib/manticore
- ./manticore.conf:/etc/manticoresearch/manticore.conf
searchd
{
listen = 9306:mysql41
listen = /var/run/mysqld/mysqld.sock:mysql41
listen = 9308:http
log = /var/log/manticore/searchd.log
query_log = /var/log/manticore/query.log
binlog_path = /var/log/manticore
pid_file = /var/run/manticore/searchd.pid
mysql_version_string = 5.0.0
}
source news_db
{
type = pgsql
sql_host = db
sql_port = 5432
sql_db = searchdb
sql_user = searchuser
sql_pass = search
}
source news_sql: news_db
{
sql_field_string = headline
sql_field_string = content_text
sql_attr_timestamp = post_date
sql_attr_bool = active
sql_query = select id, headline, content_text, extract(epoch from post_date) as post_date, true as active from news
}
index news_sql
{
min_prefix_len = 2
html_index_attrs = img=alt,title; a=title;
html_strip = 1
source = news_sql
path = /var/lib/manticore/data/news_sql
morphology = lemmatize_ru_all
}
index news_rt
{
type = rt
html_index_attrs = img=alt,title; a=title;
html_strip = 1
rt_field = find_headline
rt_field = find_content_text
rt_attr_string = headline
rt_attr_string = content_text
rt_attr_timestamp = post_date
rt_attr_bool = active
path = /var/lib/manticore/data/news_rt
morphology = lemmatize_ru_all
}
index news_delete
{
type = rt
killlist_target = news_sql:id
html_index_attrs = img=alt,title; a=title;
html_strip = 1
rt_field = find_headline
rt_field = find_content_text
rt_attr_string = headline
rt_attr_string = content_text
rt_attr_timestamp = post_date
rt_attr_bool = active
path = /var/lib/manticore/data/news_delete
morphology = lemmatize_ru_all
}
index news
{
type = distributed
local = news_sql
local = news_delete
local = news_rt
}
searchd
{
listen = 9306:mysql41
listen = /var/run/mysqld/mysqld.sock:mysql41
listen = 9308:http
log = /var/log/manticore/searchd.log
query_log = /var/log/manticore/query.log
binlog_path = /var/log/manticore
pid_file = /var/run/manticore/searchd.pid
mysql_version_string = 5.0.0
}
source news_db
{
type = pgsql
sql_host = db
sql_port = 5432
sql_db = searchdb
sql_user = searchuser
sql_pass = search
}
source news_sql: news_db
{
sql_field_string = headline
sql_field_string = content_text
sql_attr_timestamp = post_date
sql_query = select id, headline, content_text, extract(epoch from post_date) as post_date from news
}
index news_sql
{
min_prefix_len = 2
html_index_attrs = img=alt,title; a=title;
html_strip = 1
source = news_sql
path = /var/lib/manticore/data/news_sql
morphology = lemmatize_ru_all
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment