Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # Minimal Sphinx configuration for Bitrix
- #
- index bitrix
- {
- #main settings
- type = rt
- path = /var/lib/sphinxsearch/data/bitrix
- docinfo = inline
- #ondisc_attrs=1
- #choose appropriate type of morphology to use
- #morphology = lemmatize_ru_all, lemmatize_en_all, lemmatize_de_all, stem_enru
- morphology = stem_enru, soundex
- #these settings are used by bitrix:search.title component
- dict = keywords
- prefix_fields = title
- infix_fields=
- min_prefix_len = 2
- enable_star = 1
- #all fields must be defined exactly as followed
- rt_field = title
- rt_field = body
- rt_attr_uint = module_id
- rt_attr_string = module
- rt_attr_uint = item_id
- rt_attr_string = item
- rt_attr_uint = param1_id
- rt_attr_string = param1
- rt_attr_uint = param2_id
- rt_attr_string = param2
- rt_attr_timestamp = date_change
- rt_attr_timestamp = date_to
- rt_attr_timestamp = date_from
- rt_attr_uint = custom_rank
- rt_attr_multi = tags
- rt_attr_multi = right
- rt_attr_multi = site
- rt_attr_multi = param
- #depends on settings of your site
- # uncomment for single byte character set
- charset_type = sbcs
- # uncomment for UTF character set
- #charset_type = utf-8
- }
- source bitrix2
- {
- type = mysql
- sql_host = localhost
- sql_user = avselectro
- sql_pass = MDJlNjBjZT
- sql_db = avselectro
- sql_port = 3306
- sql_query_pre = SET NAMES utf8
- # sql_query_pre = SET group_concat_max_len = 4096
- # sql_query_pre = TRUNCATE TABLE `tmp_features`
- # sql_query_pre = \
- # INSERT INTO `tmp_features` (`raec_id`, `features`)\
- # SELECT `PRODUCTID`,\
- # CONCAT('{', GROUP_CONCAT(CONCAT('"', `product_values`.`FEATUREID`, '":', `product_values`.`VAL`, '')), '}') AS `features`\
- # FROM (\
- # SELECT `PRODUCTID`, `FEATUREID`, CONCAT('[', GROUP_CONCAT(CONCAT('"', IFNULL(`VALUE`, `IBLOCK_ELEMENT_ID`), '"')), ']') AS `VAL`\
- # FROM `tmp_product_feature_value_map`\
- # GROUP BY `PRODUCTID`, `FEATUREID`\
- # ) AS `product_values`\
- # GROUP BY `PRODUCTID`;
- sql_query = \
- SELECT `product`.`ID` AS `id`,\
- `product`.`XML_ID` AS `xml_id`,\
- `product`.`SHOW_COUNTER` AS `rating`,\
- `brands`.`ID` AS `brand_id`,\
- `prop`.`PROPERTY_20` AS `article`,\
- `prop`.`PROPERTY_51`>0 AS `is_sale`,\
- `prop`.`PROPERTY_52`>0 AS `is_new`,\
- `prop`.`PROPERTY_67`>0 AS `is_special`,\
- `brands`.`NAME` AS `brand`,\
- `product`.`NAME` AS `title`,\
- `product`.`DETAIL_TEXT` AS `text`,\
- `store`.`AMOUNT`>0 AS `remains`,\
- `price`.`PRICE` AS `price`,\
- `etimclasses`.`CODE` AS `etimclass_id`,\
- `tmp_features`.`features` AS `features`,\
- `tmp_features`.`values` AS `values`\
- FROM `b_iblock_element` AS `product`\
- LEFT JOIN `b_catalog_store_product` AS `store` ON `store`.`STORE_ID` = 32 AND `store`.`PRODUCT_ID` = `product`.`ID`\
- LEFT JOIN `b_catalog_price` AS `price` ON `price`.`CATALOG_GROUP_ID` = 6 AND `price`.`PRODUCT_ID` = `product`.`ID`\
- LEFT JOIN `b_iblock_element_prop_s6` AS `prop` ON `prop`.`IBLOCK_ELEMENT_ID` = `product`.`ID`\
- LEFT JOIN `b_iblock_element` AS `etimclasses` ON `etimclasses`.`IBLOCK_ID` = 4 AND `etimclasses`.`ACTIVE` = 'Y' AND `prop`.`PROPERTY_17` = `etimclasses`.`ID`\
- LEFT JOIN `b_iblock_element` AS `brands` ON `brands`.`IBLOCK_ID` = 7 AND `brands`.`ACTIVE` = 'Y' AND `prop`.`PROPERTY_19` = `brands`.`ID`\
- LEFT JOIN `tmp_features` ON `tmp_features`.`raec_id` = `prop`.`PROPERTY_27`\
- WHERE `product`.`IBLOCK_ID` = 6;
- sql_attr_multi = uint section_id from query; SELECT `IBLOCK_ELEMENT_ID` AS `id`, `IBLOCK_SECTION_ID` AS `section_id` FROM `b_iblock_section_element`
- sql_attr_uint = brand_id
- sql_attr_uint = xml_id
- sql_attr_uint = rating
- sql_attr_bool = is_sale
- sql_attr_bool = is_new
- sql_attr_bool = is_special
- sql_attr_bool = remains
- sql_attr_float = price
- sql_attr_string = etimclass_id
- sql_attr_string = title
- sql_attr_json = features
- }
- index bitrix2
- {
- type = plain
- source = bitrix2
- path = /var/www/sphinx/data/bitrix2
- mlock = 0
- morphology = stem_en, stem_ru, soundex
- min_word_len = 2
- html_strip = 1
- preopen = 1
- }
- source catalog
- {
- # Параметры подключения к БД
- type = mysql
- sql_host = localhost
- sql_user = avselectro
- sql_pass = MDJlNjBjZT
- sql_db = avselectro
- sql_port = 3306
- # Установим кодировку для работы с БД
- sql_query_pre = SET NAMES utf8
- sql_query_pre = SET CHARACTER SET utf8
- # Запрос выборки данных для индексации
- #sql_query = SELECT ID as post_id, post_title, post_content FROM wp_posts WHERE post_type = 'post'
- #sql_query = SELECT IBLOCK_ELEMENT_ID, PROPERTY_35 FROM b_iblock_element_prop_s6
- sql_query = SELECT ID, NAME, PROPERTY_35, PROPERTY_81 FROM b_iblock_element LEFT OUTER JOIN b_iblock_element_prop_s6 ON ID = IBLOCK_ELEMENT_ID WHERE IBLOCK_ID=6
- #sql_query = SELECT ID, NAME FROM b_iblock_element
- # Запрос доп. информации для вывода результата (используется утилитой "search")
- #sql_query_info = SELECT * FROM b_iblock_elemnt_prop_s6 WHERE IBLOCK_ELEMENT_ID = $id
- # Время простоя (sleep) перед посылкой запросов серверу (предназначен для разгрузки сервера БД)
- # Если установите "= 1000", то засыпание будет длится 1 секунду
- sql_ranged_throttle = 0
- }
- index catalog
- {
- # Использовать соответствующий source-блок настроек при индексации
- source = catalog
- # Путь до файлов индекса
- path = /var/www/sphinx/data/catalog
- # Использование английского и русского стемминга
- morphology = stem_enru
- # Минимальная длина индексируемого слова
- min_word_len = 2
- # Установка используемой кодировки
- #charset_type = utf-8
- }
- source ETIM_catalog
- {
- # Параметры подключения к БД
- type = mysql
- sql_host = localhost
- sql_user = avselectro
- sql_pass = MDJlNjBjZT
- sql_db = avselectro
- sql_port = 3306
- # Установим кодировку для работы с БД
- sql_query_pre = SET NAMES utf8
- sql_query_pre = SET CHARACTER SET utf8
- # Запрос выборки данных для индексации
- # sql_query = SELECT b_iblock_element.ID, b_iblock_element.NAME, b_iblock_element.CODE,b_iblock_element_prop_s4.PROPERTY_6, b_iblock_element_prop_m4.VALUE FROM b_iblock_element LEFT OUTER JOIN b_iblock_element_prop_s4 ON b_iblock_element.ID = b_iblock_element_prop_s4.IBLOCK_ELEMENT_ID LEFT OUTER JOIN b_iblock_element_prop_m4 ON b_iblock_element.ID = b_iblock_element_prop_m4.IBLOCK_ELEMENT_ID WHERE IBLOCK_ID=4
- sql_query = SELECT b_iblock_element_prop_s6.IBLOCK_ELEMENT_ID, b_iblock_element.NAME, b_iblock_element.CODE, b_iblock_element_prop_s4.PROPERTY_6, b_iblock_element_prop_m4.VALUE FROM b_iblock_element LEFT OUTER JOIN b_iblock_element_prop_s4 ON b_iblock_element.ID = b_iblock_element_prop_s4.IBLOCK_ELEMENT_ID LEFT OUTER JOIN b_iblock_element_prop_m4 ON b_iblock_element.ID = b_iblock_element_prop_m4.IBLOCK_ELEMENT_ID LEFT OUTER JOIN b_iblock_element_prop_s6 ON b_iblock_element.ID = b_iblock_element_prop_s6.PROPERTY_17 WHERE IBLOCK_ID=4
- # Время простоя (sleep) перед посылкой запросов серверу (предназначен для разгрузки сервера БД)
- # Если установите "= 1000", то засыпание будет длится 1 секунду
- sql_ranged_throttle = 0
- }
- index ETIM_catalog
- {
- # Использовать соответствующий source-блок настроек при индексации
- source = ETIM_catalog
- # Путь до файлов индекса
- path = /var/www/sphinx/data/ETIM_catalog
- # Использование английского и русского стемминга
- morphology = stem_enru
- # Минимальная длина индексируемого слова
- min_word_len = 2
- # Установка используемой кодировки
- #charset_type = utf-8
- #wordforms = /var/www/sphinx/dic.txt
- }
- source CODE_catalog
- {
- # Параметры подключения к БД
- type = mysql
- sql_host = localhost
- sql_user = avselectro
- sql_pass = MDJlNjBjZT
- sql_db = avselectro
- sql_port = 3306
- # Установим кодировку для работы с БД
- sql_query_pre = SET NAMES utf8
- sql_query_pre = SET CHARACTER SET utf8
- # Запрос выборки данных для индексации
- sql_query = SELECT IBLOCK_ELEMENT_ID, PROPERTY_27, PROPERTY_20, PROPERTY_25, PROPERTY_24 FROM b_iblock_element_prop_s6
- # Время простоя (sleep) перед посылкой запросов серверу (предназначен для разгрузки сервера БД)
- # Если установите "= 1000", то засыпание будет длится 1 секунду
- sql_ranged_throttle = 0
- }
- index CODE_catalog
- {
- # Использовать соответствующий source-блок настроек при индексации
- source = CODE_catalog
- # Путь до файлов индекса
- path = /var/www/sphinx/data/CODE_catalog
- # Использование английского и русского стемминга
- morphology = stem_enru
- # Минимальная длина индексируемого слова
- min_word_len = 2
- # Установка используемой кодировки
- #charset_type = utf-8
- #wordforms = /var/www/sphinx/dic.txt
- }
- #############################################################################
- ## indexer settings
- #############################################################################
- indexer
- {
- # memory limit, in bytes, kiloytes (16384K) or megabytes (256M)
- # optional, default is 32M, max is 2047M, recommended is 256M to 1024M
- mem_limit = 256M
- # maximum IO calls per second (for I/O throttling)
- # optional, default is 0 (unlimited)
- #
- # max_iops = 40
- # maximum IO call size, bytes (for I/O throttling)
- # optional, default is 0 (unlimited)
- #
- # max_iosize = 1048576
- # maximum xmlpipe2 field length, bytes
- # optional, default is 2M
- #
- # max_xmlpipe2_field = 4M
- # write buffer size, bytes
- # several (currently up to 4) buffers will be allocated
- # write buffers are allocated in addition to mem_limit
- # optional, default is 1M
- #
- # write_buffer = 1M
- # maximum file field adaptive buffer size
- # optional, default is 8M, minimum is 1M
- #
- # max_file_field_buffer = 32M
- lemmatizer_cache = 128M
- }
- #############################################################################
- ## searchd settings
- #############################################################################
- searchd
- {
- # [hostname:]port[:protocol], or /unix/socket/path to listen on
- # known protocols are 'sphinx' (SphinxAPI) and 'mysql41' (SphinxQL)
- #
- # multi-value, multiple listen points are allowed
- # optional, defaults are 9312:sphinx and 9306:mysql41, as below
- #
- # listen = 127.0.0.1
- # listen = 192.168.0.1:9312
- # listen = 9312
- # listen = /var/run/searchd.sock
- listen = 9312:sphinx
- listen = 9306:mysql41
- # log file, searchd run info is logged here
- # optional, default is 'searchd.log'
- log = /var/log/sphinxsearch/searchd.log
- # query log file, all search queries are logged here
- # optional, default is empty (do not log queries)
- query_log = /var/log/sphinxsearch/query.log
- # client read timeout, seconds
- # optional, default is 5
- read_timeout = 5
- # request timeout, seconds
- # optional, default is 5 minutes
- client_timeout = 300
- # maximum amount of children to fork (concurrent searches to run)
- # optional, default is 0 (unlimited)
- max_children = 30
- # PID file, searchd process ID file name
- # mandatory
- pid_file = /var/run/sphinxsearch/searchd.pid
- # max amount of matches the daemon ever keeps in RAM, per-index
- # WARNING, THERE'S ALSO PER-QUERY LIMIT, SEE SetLimits() API CALL
- # default is 1000 (just like Google)
- #max_matches = 1000
- # seamless rotate, prevents rotate stalls if precaching huge datasets
- # optional, default is 1
- seamless_rotate = 1
- # whether to forcibly preopen all indexes on startup
- # optional, default is 1 (preopen everything)
- preopen_indexes = 1
- # whether to unlink .old index copies on succesful rotation.
- # optional, default is 1 (do unlink)
- unlink_old = 1
- # attribute updates periodic flush timeout, seconds
- # updates will be automatically dumped to disk this frequently
- # optional, default is 0 (disable periodic flush)
- #
- # attr_flush_period = 900
- # instance-wide ondisk_dict defaults (per-index value take precedence)
- # optional, default is 0 (precache all dictionaries in RAM)
- #
- # ondisk_dict_default = 1
- # MVA updates pool size
- # shared between all instances of searchd, disables attr flushes!
- # optional, default size is 1M
- mva_updates_pool = 1M
- # max allowed network packet size
- # limits both query packets from clients, and responses from agents
- # optional, default size is 8M
- max_packet_size = 8M
- # crash log path
- # searchd will (try to) log crashed query to 'crash_log_path.PID' file
- # optional, default is empty (do not create crash logs)
- #
- # crash_log_path = /var/log/sphinxsearch/crash
- # max allowed per-query filter count
- # optional, default is 256
- max_filters = 256
- # max allowed per-filter values count
- # optional, default is 4096
- max_filter_values = 4096
- # socket listen queue length
- # optional, default is 5
- #
- # listen_backlog = 5
- # per-keyword read buffer size
- # optional, default is 256K
- #
- # read_buffer = 256K
- # unhinted read size (currently used when reading hits)
- # optional, default is 32K
- #
- # read_unhinted = 32K
- # max allowed per-batch query count (aka multi-query count)
- # optional, default is 32
- max_batch_queries = 200
- # max common subtree document cache size, per-query
- # optional, default is 0 (disable subtree optimization)
- #
- subtree_docs_cache = 8M
- # max common subtree hit cache size, per-query
- # optional, default is 0 (disable subtree optimization)
- #
- subtree_hits_cache = 16M
- # multi-processing mode (MPM)
- # known values are none, fork, prefork, and threads
- # optional, default is fork
- #
- workers = threads
- # max threads to create for searching local parts of a distributed index
- # optional, default is 0, which means disable multi-threaded searching
- # should work with all MPMs (ie. does NOT require workers=threads)
- #
- # dist_threads = 4
- # binlog files path; use empty string to disable binlog
- # optional, default is build-time configured data directory
- #
- # binlog_path = # disable logging
- # binlog_path = /var/lib/sphinxsearch/data # binlog.001 etc will be created there
- binlog_path = /var/lib/sphinxsearch/data/
- # binlog flush/sync mode
- # 0 means flush and sync every second
- # 1 means flush and sync every transaction
- # 2 means flush every transaction, sync every second
- # optional, default is 2
- #
- binlog_flush = 2
- # binlog per-file size limit
- # optional, default is 128M, 0 means no limit
- #
- binlog_max_log_size = 512M
- # per-thread stack size, only affects workers=threads mode
- # optional, default is 64K
- #
- # thread_stack = 128K
- # per-keyword expansion limit (for dict=keywords prefix searches)
- # optional, default is 0 (no limit)
- #
- # expansion_limit = 1000
- # RT RAM chunks flush period
- # optional, default is 0 (no periodic flush)
- #
- rt_flush_period = 3600
- # query log file format
- # optional, known values are plain and sphinxql, default is plain
- #
- query_log_format = sphinxql
- # version string returned to MySQL network protocol clients
- # optional, default is empty (use Sphinx version)
- #
- # mysql_version_string = 5.0.37
- # trusted plugin directory
- # optional, default is empty (disable UDFs)
- #
- # plugin_dir = /usr/local/sphinx/lib
- # default server-wide collation
- # optional, default is libc_ci
- #
- # collation_server = utf8_general_ci
- # server-wide locale for libc based collations
- # optional, default is C
- #
- # collation_libc_locale = ru_RU.UTF-8
- # threaded server watchdog (only used in workers=threads mode)
- # optional, values are 0 and 1, default is 1 (watchdog on)
- #
- # watchdog = 1
- # SphinxQL compatibility mode (legacy columns and their names)
- # optional, default is 0 (SQL compliant syntax and result sets)
- #
- # compat_sphinxql_magics = 1
- }
- # common settings
- common
- {
- json_autoconv_numbers = 1
- #json_autoconv_keynames = lowercase
- lemmatizer_base = /etc/sphinxsearch/dicts/
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement