Sphinx.conf

From Doku
Revision as of 10:06, 2 November 2020 by Sebas (talk | contribs) (Created page with "# # Sphinx configuration file sample # ############################################################################# ## data source definition ###############################...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
  1. Sphinx configuration file sample
    1. data source definition

source sku_products { # data source type. mandatory, no default value # known types are mysql, pgsql, mssql, xmlpipe, xmlpipe2, odbc type = mysql

##################################################################### ## SQL settings (for 'mysql' and 'pgsql' types) #####################################################################

# some straightforward parameters for SQL source types sql_host = localhost sql_user = root sql_pass = sebastian sql_db = sku_io sql_port = 3306 # optional, default is 3306


# pre-query, executed before the main fetch query # multi-value, optional, default is empty list of queries # sql_query_pre = SET NAMES utf8


# main document fetch query # mandatory, integer document ID field MUST be the first selected column sql_query = SELECT id, parent_id, brand_id, sku, name, barcode, mpn FROM products

   sql_attr_uint = parent_id
   sql_attr_uint = brand_id

}

source sku_attributes { # data source type. mandatory, no default value # known types are mysql, pgsql, mssql, xmlpipe, xmlpipe2, odbc type = mysql

##################################################################### ## SQL settings (for 'mysql' and 'pgsql' types) #####################################################################

# some straightforward parameters for SQL source types sql_host = localhost sql_user = root sql_pass = sebastian sql_db = sku_io sql_port = 3306 # optional, default is 3306


# pre-query, executed before the main fetch query # multi-value, optional, default is empty list of queries # sql_query_pre = SET NAMES utf8


# main document fetch query # mandatory, integer document ID field MUST be the first selected column sql_query = SELECT id, product_id, attribute_id, value FROM product_attributes

   sql_attr_uint = product_id
   sql_attr_uint = attribute_id

}

    1. index definition

index sku_products {

   source = sku_products
   path   = /var/sphinxsearch/sku_products.sphinx.index
   morphology   = stem_en     #, metaphone # You can add metaphone morphology if you want.
   min_word_len = 1           # Indexes all words
   blend_chars  = -           # This presumes people won't type a hyphen into the search bar: quite likely
   blend_mode   = trim_both   #
   html_strip   = 1           # Just in case anyone tries to get clever in the admin panel and use HTML


   # <substrings section>
       # Index substrings too, down to 3 chars but no less
       min_infix_len = 3
       # These three options are needed to differentiate full word matches from
       # infix (substring) matches and rank them higher
       dict = keywords
       index_exact_words = 1
       expand_keywords = 1
   # </substrings section>

}

index sku_attributes {

   source = sku_attributes
   path   = /var/sphinxsearch/sku_attributes.sphinx.index
   morphology   = stem_en     #, metaphone # You can add metaphone morphology if you want.
   min_word_len = 1           # Indexes all words
   blend_chars  = -           # This presumes people won't type a hyphen into the search bar: quite likely
   blend_mode   = trim_both   #
   html_strip   = 1           # Just in case anyone tries to get clever in the admin panel and use HTML

}

  1. index sku_attributes {
  2. type = rt
  3. path = /var/sphinxsearch/sku_attributes.sphinx.index
  4. rt_mem_limit = 2047M
  5. rt_attr_uint = id
  6. rt_attr_uint = product_id
  7. rt_attr_uint = attribute_id
  8. rt_field = value
  9. }
    1. indexer settings

indexer { # memory limit, in bytes, kiloytes (16384K) or megabytes (256M) # optional, default is 128M, max is 2047M, recommended is 256M to 1024M mem_limit = 1024M }

    1. 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 = 9312 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 = 10

# request timeout, seconds # optional, default is 5 minutes client_timeout = 10

# maximum amount of children to fork (concurrent searches to run) # optional, default is 0 (unlimited) max_children = 30

# maximum amount of persistent connections from this master to each agent host # optional, but necessary if you use agent_persistent. It is reasonable to set the value # as max_children, or less on the agent's hosts. persistent_connections_limit = 30

# PID file, searchd process ID file name # mandatory pid_file = /var/log/sphinxsearch/searchd.pid

# 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


# 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

# 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

# max allowed per-batch query count (aka multi-query count) # optional, default is 32 max_batch_queries = 32

# multi-processing mode (MPM) # known values are none, fork, prefork, and threads # threads is required for RT backend to work # optional, default is threads workers = threads # for RT to work }

  1. --eof--