Sphinx Search (sphinx.conf)

Sphinx Search - Exemplo

Categoria: Banco de dados

Software: Sphinx Search

[ Hits: 7.858 ]

Por: Candido Tominaga



Na compilação padrão, você deve colocar esse arquivo em /usr/local/etc/sphinx.conf



Exemplo de uma configuração:


source oficial
{
        type    = mysql

        sql_host        = localhost
        sql_user        = usuario
        sql_pass        = senha
        sql_db          = oficial
        sql_port        = 3306

        sql_query       = SELECT veiculo_id, veiculo_status, veiculo_vencimento, regiao_id, cidade_id, floor(rand() * 1000000000) as rnd, veiculo_modelo, veiculo_marca, veiculo_combustivel FROM veiculo

        sql_attr_uint           = regiao_id
        sql_attr_uint           = cidade_id
        sql_attr_uint           = rnd
        sql_attr_uint           = veiculo_status
        sql_attr_timestamp      = veiculo_vencimento

        # Versao 0.9.7
        sql_group_column        = regiao_id
        sql_group_column        = cidade_id
        sql_group_column        = rnd
        sql_group_column        = pat
        sql_group_column        = veiculo_status
        sql_date_column         = veiculo_vencimento
        sql_group_column        = veiculo_particular



}
index idx_oficial
{
        source                  = oficial
        path                    = /var/data/oficial
        docinfo                 = extern
        mlock                   = 0
        morphology              = none
        # stopwords                     = /var/data/stopwords.txt
        # wordforms                     = /var/data/wordforms.txt
        # exceptions            = /var/data/exceptions.txt
        min_word_len            = 2
        charset_type            = sbcs
        # min_prefix_len        = 0
        # min_infix_len         = 0
        # prefix_fields         = filename
        # infix_fields          = url, domain
        enable_star             = 1
        # ngram_len                             = 1
        # ngram_chars                   = U+3000..U+2FA1F
        # phrase_boundary               = ., ?, !, U+2026 # horizontal ellipsis
        # phrase_boundary_step  = 100
        html_strip                              = 1
        # html_index_attrs              = img=alt,title; a=title;
        # html_remove_elements  = style, script
        # preopen                               = 1

}
index idx_oficialstemmed : idx_oficial
{
        path                    = /var/data/idx_oficial
        morphology              = stem_en
}

#############################################################################
## 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                       = 128M

        # 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
}

#############################################################################
## searchd settings
#############################################################################

searchd
{
        # IP address to bind on
        # optional, default is 0.0.0.0 (ie. listen on all interfaces)
        #
        # address                               = 127.0.0.1
        # address                               = 192.168.0.1
        address                         = 127.0.0.1

        # searchd TCP port number
        # mandatory, default is 3312
        port                            = 3312

        # log file, searchd run info is logged here
        # optional, default is 'searchd.log'
        log                                     = /var/log/searchd.log

        # query log file, all search queries are logged here
        # optional, default is empty (do not log queries)
        query_log                       = /var/log/query.log

        # client read timeout, seconds
        # optional, default is 5
        read_timeout            = 5

        # 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/log/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 0 (do not preopen)
        preopen_indexes         = 0

        # whether to unlink .old index copies on succesful rotation.
        # optional, default is 1 (do unlink)
        unlink_old                      = 1
}

# --eof--
  


Comentários
[1] Comentário enviado por comfaa em 28/10/2008 - 10:51h

muito bom !!


[2] Comentário enviado por amaxnet em 13/10/2010 - 14:19h

estou procurando um bom material sobre indexação com sphinx e mysql... você pode me indicar algum?


Contribuir com comentário

  



Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts