JuangaCovas.info

La página personal de Juan Gabriel Covas

Herramientas de usuario

Herramientas del sitio


linux:howtos:manticore-playground

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anterior Revisión previa
linux:howtos:manticore-playground [23/08/2021 18:32]
Juanga Covas [Windows]
linux:howtos:manticore-playground [23/08/2021 19:15] (actual)
Juanga Covas [Comments]
Línea 111: Línea 111:
 # can also be escaped using \. Escaping is required if # is present in database credential in source declarations. # can also be escaped using \. Escaping is required if # is present in database credential in source declarations.
  
 +===== Source =====
 +
 +Nice usage of ''sql_query_pre'', ''sql_query_range'', ''sql_range_step'', and ''sql_query_post_index''. As seen [[https://blog.ardabeyazoglu.com/using-manticoresphinx-search-with-mysql-cjxs1lei300221ws1t83ubagj|here]].
 +
 +A table to keep some indexing information
 +  CREATE TABLE `product_search_status`  (
 +    `id` varchar(30) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
 +    `value` bigint(20) UNSIGNED NOT NULL,
 +    PRIMARY KEY (`id`) USING BTREE
 +  ) ENGINE = InnoDB;
 +
 +<code|''**source configuration in manticore**''>
 +      # we set unicode charset and wait_timeout to a high value to prevent connection timeout errors
 +      sql_query_pre = SET NAMES utf8
 +      sql_query_pre = SET SESSION wait_timeout=3600
 +      # we store the index time for information
 +      sql_query_pre = REPLACE INTO product_search_status (id, value) VALUES ('last_indexed_time', UNIX_TIMESTAMP())
 +      # we set start-end document ids so that manticore will know where to start and stop indexing 
 +      sql_query_range = SELECT MIN(id), MAX(id) FROM product
 +      sql_range_step = 10000
 +      # this is the main query to create documents
 +      sql_query = SELECT \
 +                       id, \
 +                       name AS name_ft, \
 +                       categories AS categories_ft, \
 +                       name \
 +                 FROM product \
 +                 WHERE id >= $start AND id <= $end
 +      # we store the most recent document id for information
 +      sql_query_post_index = REPLACE INTO product_search_status (id, value) VALUES ('last_indexed_id', $maxid)
 +</code>
  
linux/howtos/manticore-playground.txt · Última modificación: 23/08/2021 19:15 por Juanga Covas