Joywork/docker/sphinx2/conf/sphinx.conf
2026-05-22 21:21:54 +03:00

642 lines
20 KiB
Plaintext

source base
{
type = mysql
sql_host = db
sql_user = root
sql_pass = root
sql_db = u0305746_jw
sql_port = 3306 # optional, default is 3306
#sql_sock = /opt/sphinx/index/mysqld/mysqld.sock
sql_query_pre = SET NAMES utf8
sql_query_pre = SET CHARACTER SET utf8
mysql_connect_flags = 32 # enable compression
}
source objects_index:base
{
sql_query_pre = SET NAMES 'utf8'
sql_query_pre = SET CHARACTER SET utf8
sql_query_pre = SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'
sql_query = \
SELECT o.id, \
o.type, \
o.rayon as rayon_id, \
o.commission, \
o.etazh, \
o.adres, \
o.srok, \
o.peshkom, \
o.transport, \
o.land_area, \
o.ploshad, \
o.ploshad_komn, \
o.ploshad_k, \
o.komnat, \
o.komnat as komnat_str, \
o.holod, \
o.stirka, \
o.tv, \
o.mebel, \
o.stoim, \
UNIX_TIMESTAMP(o.date_add) as date_add, \
UNIX_TIMESTAMP(o.date_really_add) as date_really_add, \
o.stoim_prim, \
IF((SELECT count(id) FROM objects_object_photo where object_id=o.id)>0 ,1,0) as is_photo, \
o.id_ap, \
o.id_ap_user_object, \
o.id_add_user, \
o.id_emls, \
o.id_emls_user_object, \
o.id_rf_region, \
o.cadastral_number, \
o.parking_type_id, \
o.type_category, \
o.archive, \
o.id_frent, \
o.moder, \
o.black, \
o.phone_search, \
o.operation_type, \
o.ellada, \
o.use_in_advert, \
IF(o.fbn_id is NULL or o.fbn_id='', 0, 1) as fbn_id, \
o.add_to_yandex_feed, \
o.add_to_zipal, \
o.add_to_avito_feed, \
o.add_to_cian_feed, \
o.add_to_domclick_feed, \
o.add_to_emls_feed, \
o.add_to_bn_feed, \
o.studio_flag, \
sp_metro.id_metro, \
reg.parent, \
s.house_type, \
s.build_year, \
s.deal_type, \
a.tax_number, \
a.legal_address, \
a.isOccupied, \
a.layout_id, \
a.number_wet_spots, \
a.electricity_power, \
a.isFurniture, \
a.commer_access, \
a.parking_price, \
a.parkingIsFree, \
a.ceiling_height, \
a.column_grid, \
a.vat_type_id, \
a.commerc_site, \
a.commerc_owned, \
a.floor_material_id, \
a.commerc_portal_id, \
a.commerc_land_category_id, \
a.commerc_permitted_use_id, \
a.commerc_lift1, \
a.lift1_carrying, \
a.commerc_lift2, \
a.lift2_carrying, \
a.commerc_lift3, \
a.lift3_carrying, \
a.commerc_crane1, \
a.crane1_carrying, \
a.commerc_crane2, \
a.crane2_carrying, \
a.commerc_crane3, \
a.crane3_carrying, \
a.commerc_crane4, \
a.crane4_carrying, \
a.commerc_electricity_id, \
a.commerc_gas_id, \
a.commerc_water_id, \
a.commerc_sewage_id, \
a.commerc_driveways_id, \
a.commerc_year, \
a.commerc_building_type_id, \
a.commerc_building_class_id, \
a.commerc_specifications, \
a.commerc_purpose, \
a.commerc_infrastructure, \
a.building_area, \
a.commerc_houseLineType_id, \
a.commerc_building_category_id, \
a.commerc_opened_id, \
a.commerc_building_ventilation, \
a.commerc_building_conditioning, \
a.commerc_building_heating, \
a.commerc_building_fire, \
a.garage_type_id, \
a.garage_vid_id, \
a.boks_vid_id, \
a.commerc_status_id, \
ads.ads_source, \
ads.ads_agent, \
op.currency, \
op.price_avito, \
IF(complex.complex_id > 0,complex.complex_id,0) as complex_id, \
0 as del, \
IF(o.id_frent > 0 OR ads.ads_agent = 0, 0, 1) as is_agent, \
IF((SELECT count(*) FROM ads_stats where object_id = o.id AND service_id = 1 AND is_error = 1) > 0, 1, 0) as ads_avito_error, \
IF((SELECT count(*) FROM ads_stats where object_id = o.id AND service_id = 2 AND is_error = 1) > 0, 1, 0) as ads_cian_error, \
IF((SELECT count(*) FROM ads_stats where object_id = o.id AND service_id = 3 AND is_error = 1) > 0, 1, 0) as ads_yandex_error, \
IF((SELECT count(*) FROM ads_stats where object_id = o.id AND service_id = 4 AND is_error = 1) > 0, 1, 0) as ads_domclick_error, \
IF(o.id_ap > 0 or o.id_add_user > 0 or ads.ads_agent > 0, 1, 0) as is_agent_ap, \
IF(o.fbn_id is not null or o.id_emls > 0 or o.id_ap > 0 or o.id_add_user > 0 or ads.ads_agent > 0, 1, 0) as is_agent_fbn, \
IF(o.id_frent > 0 or o.fbn_id is not null or o.id_emls > 0 or o.id_ap > 0 or o.id_add_user > 0 or ads.id > 0, 1, 0) as is_agent_all, \
IF(o.archive=1 or o.id_frent <> 0 or ads.ads_agent = 0, 1, 0) as is_agent_sobtv, \
IF(op.currency = 0 or op.currency is null, o.stoim, op.price_avito) as price_for_order, \
IF(o.type = 7, ROUND(o.stoim / o.land_area), ROUND(o.stoim / o.ploshad)) as area_price, \
l.latitude, l.longitude, \
UNIX_TIMESTAMP(nb.nb_end_date) as nb_end_date, \
IF(oc.country_id > 0, oc.country_id, 171) as country_id, \
IF(op.currency > 0, op.price_avito, o.stoim) as sort_price \
FROM objects as o \
LEFT JOIN ads_objects AS ads ON o.id = ads.obj_id \
LEFT JOIN rf_regions as reg ON reg.id = o.id_rf_region \
LEFT JOIN sp_metro as sp_metro ON o.id = sp_metro.id_obj \
LEFT JOIN rayon as r ON o.rayon = r.id \
LEFT JOIN sale_objects AS s ON o.id = s.object_id \
LEFT JOIN objects_additional_information as a on o.id = a.object_id \
LEFT JOIN object_location as l on l.object_id = o.id \
LEFT JOIN complex_objects as complex on complex.object_id = o.id \
LEFT JOIN object_nb_info as nb on nb.object_id = o.id \
LEFT JOIN object_country as oc on oc.object_id = o.id \
LEFT JOIN object_prices as op ON op.object_id = o.id
sql_attr_bigint = price_for_order
sql_attr_bigint = area_price
sql_attr_bigint = type
sql_attr_bigint = rayon_id
sql_field_string = adres
sql_attr_bigint = srok
sql_attr_bigint = komnat
sql_field_string = komnat_str
sql_attr_bigint = etazh
sql_attr_float = ploshad
sql_attr_float = ploshad_k
sql_attr_bigint = holod
sql_attr_bigint = stirka
sql_attr_bigint = tv
sql_attr_bigint = mebel
sql_attr_bigint = stoim
sql_attr_bigint = date_add
sql_attr_bigint = date_really_add
sql_attr_float = ploshad_komn
sql_field_string = stoim_prim
sql_attr_bigint = peshkom
sql_attr_bigint = transport
sql_attr_uint = is_photo
sql_attr_uint = archive
sql_attr_uint = operation_type
sql_attr_uint = ellada
sql_attr_uint = use_in_advert
sql_field_string = phone_search
sql_attr_bigint = black
sql_attr_bigint = moder
sql_attr_uint = id_frent
sql_field_string = id_ap
sql_attr_bigint = id_add_user
sql_attr_bigint = commission
sql_field_string = id_ap_user_object
sql_attr_uint = type_category
sql_field_string = id_emls
sql_field_string = id_emls_user_object
sql_field_string = cadastral_number
sql_attr_bigint = land_area
sql_attr_bigint = parking_type_id
sql_field_string = id_rf_region
sql_field_string = parent
sql_attr_uint = fbn_id
sql_attr_uint = add_to_yandex_feed
sql_attr_uint = add_to_zipal
sql_attr_uint = add_to_avito_feed
sql_attr_uint = add_to_cian_feed
sql_attr_uint = add_to_domclick_feed
sql_attr_uint = add_to_emls_feed
sql_attr_uint = add_to_bn_feed
sql_attr_uint = studio_flag
sql_attr_bigint = id_metro
sql_attr_bigint = house_type
sql_attr_bigint = build_year
sql_attr_uint = deal_type
sql_attr_float = ceiling_height
sql_attr_uint = vat_type_id
sql_attr_uint = legal_address
sql_attr_uint = isOccupied
sql_attr_uint = layout_id
sql_attr_uint = number_wet_spots
sql_attr_uint = electricity_power
sql_attr_uint = isFurniture
sql_attr_uint = commer_access
sql_attr_uint = parking_price
sql_attr_uint = parkingIsFree
sql_attr_uint = commerc_year
sql_attr_uint = commerc_building_type_id
sql_attr_uint = commerc_building_class_id
sql_attr_float = building_area
sql_attr_float = commerc_site
sql_attr_uint = commerc_owned
sql_attr_uint = commerc_building_category_id
sql_attr_uint = commerc_building_ventilation
sql_attr_uint = commerc_building_conditioning
sql_attr_uint = commerc_building_heating
sql_attr_uint = commerc_building_fire
sql_attr_uint = commerc_houseLineType_id
sql_attr_uint = commerc_opened_id
sql_field_string = commerc_infrastructure
sql_attr_uint = column_grid
sql_attr_uint = tax_number
sql_attr_uint = floor_material_id
sql_attr_uint = commerc_portal_id
sql_field_string = commerc_purpose
sql_field_string = commerc_specifications
sql_attr_uint = commerc_land_category_id
sql_attr_uint = commerc_permitted_use_id
sql_attr_uint = commerc_electricity_id
sql_attr_uint = commerc_gas_id
sql_attr_uint = commerc_water_id
sql_attr_uint = commerc_sewage_id
sql_attr_uint = commerc_driveways_id
sql_attr_uint = garage_type_id
sql_attr_uint = commerc_lift1
sql_attr_uint = lift1_carrying
sql_attr_uint = commerc_lift2
sql_attr_uint = lift2_carrying
sql_attr_uint = commerc_lift3
sql_attr_uint = lift3_carrying
sql_attr_uint = commerc_crane1
sql_attr_uint = crane1_carrying
sql_attr_uint = commerc_crane2
sql_attr_uint = crane2_carrying
sql_attr_uint = commerc_crane3
sql_attr_uint = crane3_carrying
sql_attr_uint = commerc_crane4
sql_attr_uint = crane4_carrying
sql_attr_uint = garage_vid_id
sql_attr_uint = boks_vid_id
sql_attr_uint = commerc_status_id
sql_attr_bigint = ads_source
sql_attr_uint = ads_agent
sql_attr_uint = is_agent
sql_attr_uint = is_agent_ap
sql_attr_uint = is_agent_fbn
sql_attr_uint = is_agent_all
sql_attr_uint = is_agent_sobtv
sql_field_string = latitude
sql_field_string = longitude
sql_attr_uint = complex_id
sql_attr_uint = del
sql_attr_uint = ads_avito_error
sql_attr_uint = ads_cian_error
sql_attr_uint = ads_yandex_error
sql_attr_uint = ads_domclick_error
sql_attr_bigint = nb_end_date
sql_attr_uint = country_id
sql_attr_bigint = sort_price
}
index objects_index
{
source = objects_index
path = /opt/sphinx/index/objects.index
morphology = stem_enru
expand_keywords = 1
min_infix_len = 3
index_exact_words=1
}
index objects_rt
{
type = rt
path = /opt/sphinx/index/objects.rt
# Описание всех полей для индексирования
rt_field = area_price
rt_field = id
rt_field = type
rt_field = rayon_id
rt_field = commission
rt_field = etazh
rt_field = adres
rt_field = srok
rt_field = peshkom
rt_field = transport
rt_field = land_area
rt_field = ploshad
rt_field = ploshad_komn
rt_field = ploshad_k
rt_field = komnat
rt_field = komnat_str
rt_field = holod
rt_field = stirka
rt_field = tv
rt_field = mebel
rt_field = stoim
rt_field = date_add
rt_field = date_really_add
rt_field = stoim_prim
rt_field = is_photo
rt_field = id_ap
rt_field = id_ap_user_object
rt_field = id_add_user
rt_field = id_emls
rt_field = id_emls_user_object
rt_field = id_rf_region
rt_field = cadastral_number
rt_field = parking_type_id
rt_field = archive
rt_field = id_frent
rt_field = moder
rt_field = black
rt_field = phone_search
rt_field = operation_type
rt_field = ellada
rt_field = use_in_advert
rt_field = type_category
rt_field = fbn_id
rt_field = add_to_yandex_feed
rt_field = add_to_zipal
rt_field = add_to_avito_feed
rt_field = add_to_cian_feed
rt_field = add_to_domclick_feed
rt_field = add_to_emls_feed
rt_field = add_to_bn_feed
rt_field = studio_flag
rt_field = id_metro
rt_field = parent
rt_field = house_type
rt_field = build_year
rt_field = deal_type
rt_field = tax_number
rt_field = legal_address
rt_field = isOccupied
rt_field = layout_id
rt_field = number_wet_spots
rt_field = electricity_power
rt_field = isFurniture
rt_field = commer_access
rt_field = parking_price
rt_field = parkingIsFree
rt_field = ceiling_height
rt_field = column_grid
rt_field = vat_type_id
rt_field = commerc_site
rt_field = commerc_owned
rt_field = floor_material_id
rt_field = commerc_portal_id
rt_field = commerc_land_category_id
rt_field = commerc_permitted_use_id
rt_field = commerc_lift1
rt_field = lift1_carrying
rt_field = commerc_lift2
rt_field = lift2_carrying
rt_field = commerc_lift3
rt_field = lift3_carrying
rt_field = commerc_crane1
rt_field = crane1_carrying
rt_field = commerc_crane2
rt_field = crane2_carrying
rt_field = commerc_crane3
rt_field = crane3_carrying
rt_field = commerc_crane4
rt_field = crane4_carrying
rt_field = commerc_electricity_id
rt_field = commerc_gas_id
rt_field = commerc_water_id
rt_field = commerc_sewage_id
rt_field = commerc_driveways_id
rt_field = commerc_year
rt_field = commerc_building_type_id
rt_field = commerc_building_class_id
rt_field = commerc_specifications
rt_field = commerc_purpose
rt_field = commerc_infrastructure
rt_field = building_area
rt_field = commerc_houseLineType_id
rt_field = commerc_building_category_id
rt_field = commerc_opened_id
rt_field = commerc_building_ventilation
rt_field = commerc_building_conditioning
rt_field = commerc_building_heating
rt_field = commerc_building_fire
rt_field = garage_type_id
rt_field = garage_vid_id
rt_field = boks_vid_id
rt_field = commerc_status_id
rt_field = ads_source
rt_field = ads_agent
rt_field = is_agent
rt_field = is_agent_ap
rt_field = is_agent_fbn
rt_field = is_agent_all
rt_field = is_agent_sobtv
rt_field = latitude
rt_field = longitude
rt_field = complex_id
rt_field = del
rt_field = ads_avito_error
rt_field = ads_cian_error
rt_field = ads_yandex_error
rt_field = ads_domclick_error
rt_field = nb_end_date
rt_field = country_id
rt_field = sort_price
rt_attr_bigint = type
rt_attr_bigint = rayon_id
rt_attr_string = adres
rt_attr_bigint = srok
rt_attr_bigint = komnat
rt_attr_string = komnat_str
rt_attr_bigint = etazh
rt_attr_float = ploshad
rt_attr_float = ploshad_k
rt_attr_bigint = holod
rt_attr_bigint = stirka
rt_attr_bigint = tv
rt_attr_bigint = mebel
rt_attr_bigint = stoim
rt_attr_bigint = date_add
rt_attr_bigint = date_really_add
rt_attr_float = ploshad_komn
rt_attr_string = stoim_prim
rt_attr_bigint = peshkom
rt_attr_bigint = transport
rt_attr_uint = is_photo
rt_attr_uint = archive
rt_attr_uint = operation_type
rt_attr_uint = ellada
rt_attr_uint = use_in_advert
rt_attr_string = phone_search
rt_attr_bigint = black
rt_attr_bigint = moder
rt_attr_bigint = price_for_order
rt_attr_bigint = area_price
rt_attr_uint = id_frent
rt_attr_string = id_ap
rt_attr_bigint = id_add_user
rt_attr_bigint = commission
rt_attr_string = id_ap_user_object
rt_attr_uint = type_category
rt_attr_string = id_emls
rt_attr_string = id_emls_user_object
rt_attr_string = cadastral_number
rt_attr_bigint = sort_price
rt_attr_bigint = land_area
rt_attr_bigint = parking_type_id
rt_attr_string = id_rf_region
rt_attr_string = parent
rt_attr_uint = fbn_id
rt_attr_uint = add_to_yandex_feed
rt_attr_uint = add_to_zipal
rt_attr_uint = add_to_avito_feed
rt_attr_uint = add_to_cian_feed
rt_attr_uint = add_to_domclick_feed
rt_attr_uint = add_to_emls_feed
rt_attr_uint = add_to_bn_feed
rt_attr_uint = studio_flag
rt_attr_bigint = id_metro
rt_attr_bigint = house_type
rt_attr_bigint = build_year
rt_attr_uint = deal_type
rt_attr_float = ceiling_height
rt_attr_uint = vat_type_id
rt_attr_uint = legal_address
rt_attr_uint = isOccupied
rt_attr_uint = layout_id
rt_attr_uint = number_wet_spots
rt_attr_uint = electricity_power
rt_attr_uint = isFurniture
rt_attr_uint = commer_access
rt_attr_uint = parking_price
rt_attr_uint = parkingIsFree
rt_attr_uint = commerc_year
rt_attr_uint = commerc_building_type_id
rt_attr_uint = commerc_building_class_id
rt_attr_float = building_area
rt_attr_float = commerc_site
rt_attr_uint = commerc_owned
rt_attr_uint = commerc_building_category_id
rt_attr_uint = commerc_building_ventilation
rt_attr_uint = commerc_building_conditioning
rt_attr_uint = commerc_building_heating
rt_attr_uint = commerc_building_fire
rt_attr_uint = commerc_houseLineType_id
rt_attr_uint = commerc_opened_id
rt_attr_string = commerc_infrastructure
rt_attr_uint = column_grid
rt_attr_uint = tax_number
rt_attr_uint = floor_material_id
rt_attr_uint = commerc_portal_id
rt_attr_string = commerc_purpose
rt_attr_string = commerc_specifications
rt_attr_uint = commerc_land_category_id
rt_attr_uint = commerc_permitted_use_id
rt_attr_uint = commerc_electricity_id
rt_attr_uint = commerc_gas_id
rt_attr_uint = commerc_water_id
rt_attr_uint = commerc_sewage_id
rt_attr_uint = commerc_driveways_id
rt_attr_uint = garage_type_id
rt_attr_uint = commerc_lift1
rt_attr_uint = lift1_carrying
rt_attr_uint = commerc_lift2
rt_attr_uint = lift2_carrying
rt_attr_uint = commerc_lift3
rt_attr_uint = lift3_carrying
rt_attr_uint = commerc_crane1
rt_attr_uint = crane1_carrying
rt_attr_uint = commerc_crane2
rt_attr_uint = crane2_carrying
rt_attr_uint = commerc_crane3
rt_attr_uint = crane3_carrying
rt_attr_uint = commerc_crane4
rt_attr_uint = crane4_carrying
rt_attr_uint = garage_vid_id
rt_attr_uint = boks_vid_id
rt_attr_uint = commerc_status_id
rt_attr_bigint = ads_source
rt_attr_bigint = ads_agent
rt_attr_uint = is_agent
rt_attr_uint = is_agent_ap
rt_attr_uint = is_agent_fbn
rt_attr_uint = is_agent_all
rt_attr_uint = is_agent_sobtv
rt_attr_string = latitude
rt_attr_string = longitude
rt_attr_uint = complex_id
rt_attr_uint = del
rt_attr_uint = ads_avito_error
rt_attr_uint = ads_cian_error
rt_attr_uint = ads_yandex_error
rt_attr_uint = ads_domclick_error
rt_attr_bigint = nb_end_date
rt_attr_uint = country_id
rt_mem_limit = 512M
morphology = stem_enru
expand_keywords = 1
min_infix_len = 3
index_exact_words=1
}
index objects
{
type = distributed
local = objects_index
local = objects_rt
morphology = stem_enru
expand_keywords = 1
min_infix_len = 3
index_exact_words = 1
}
searchd
{
listen = 9312
listen = 9306:mysql41
log = /opt/sphinx/log/sphinx-searchd2.log
query_log = /opt/sphinx/log/sphinx-query2.log
query_log_format = sphinxql
read_timeout = 5
max_children = 15
pid_file = /opt/sphinx/index/searchd.pid
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
workers = threads # for RT to work
binlog_path = /opt/sphinx/binlog
}