Subversion Repositories Applications.papyrus

Rev

Rev 2108 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#
# Minimal Sphinx configuration sample (clean, simple, functional)
#
# http://www.tela-botanica.org/page:recherche
# mysql -h0 -P 9306
# SELECT * FROM i_spip WHERE MATCH('@texte mousse');

# sudo sphinx-indexer i_spip -c /etc/sphinx/sphinx-min.conf
# sudo sphinx-searchd -c /etc/sphinx/sphinx-min.conf
source common
{
        type                    = mysql

        sql_host                = localhost
        sql_user                = root
        sql_pass                =
        sql_db                  = raphdb
        sql_sock                = /home/raphael/web/mysql/mysql.sock
    sql_query_pre   = SET NAMES utf8
}


index i_common
{
        # source                        =
        # path                  = /var/lib/sphinx/XXX
        docinfo                 = extern
        charset_type    = sbcs
        stopwords               = /etc/sphinx/stopwords.txt

    # http://sphinxsearch.com/docs/2.1.1/conf-morphology.html
        morphology              = libstemmer_french
        enable_star             = 1
    min_word_len    = 3
    # min_prefix_len  = 3
    min_infix_len   = 3

    # prefix_fields   = 
    # infix_fields    = 

    phrase_boundary = ., ?, !, U+2026

    # http://sphinxsearch.com/wiki/doku.php?id=charset_tables
    # mysql raphdb<<<"SELECT p_description FROM projet WHERE p_id = 121"|xxd
    # sphinx-search -q -c sphinx-min.conf -i i_projet "homoge*|homogé"|grep -w hits
    # SELECT * FROM i_projet WHERE MATCH('homoge*|homogé'); SHOW META;
    charset_table               = U+00C8->e, U+00C9->e, U+00CA->e, U+00CB->e, U+00E8->e, U+00E9->e, U+00EA->e, U+00EB->e, U+0112->e, U+0113->e, U+0114->e, U+0115->e, U+0116->e, U+0117->e, U+0118->e, U+0119->e, U+011A->e, U+011B->e, U+018E->e, U+0190->e, U+01DD->e, U+0204->e, U+0205->e, U+0206->e, U+0207->e, U+0228->e, U+0229->e, U+0246->e, U+0247->e, U+0258->e, U+025B->e, U+025C->e, U+025D->e, U+025E->e, U+029A->e, U+1D07->e, U+1D08->e, U+1D31->e, U+1D32->e, U+1D49->e, U+1D4B->e, U+1D4C->e, U+1D92->e, U+1D93->e, U+1D94->e, U+1D9F->e, U+1E14->e, U+1E15->e, U+1E16->e, U+1E17->e, U+1E18->e, U+1E19->e, U+1E1A->e, U+1E1B->e, U+1E1C->e, U+1E1D->e, U+1EB8->e, U+1EB9->e, U+1EBA->e, U+1EBB->e, U+1EBC->e, U+1EBD->e, U+1EBE->e, U+1EBF->e, U+1EC0->e, U+1EC1->e, U+1EC2->e, U+1EC3->e, U+1EC4->e, U+1EC5->e, U+1EC6->e, U+1EC7->e, U+2091->e, \
    U+00CC->i, U+00CD->i, U+00CE->i, U+00CF->i, U+00EC->i, U+00ED->i, U+00EE->i, U+00EF->i, U+010309->i, U+0128->i, U+0129->i, U+012A->i, U+012B->i, U+012C->i, U+012D->i, U+012E->i, U+012F->i, U+0130->i, U+0131->i, U+0197->i, U+01CF->i, U+01D0->i, U+0208->i, U+0209->i, U+020A->i, U+020B->i, U+0268->i, U+026A->i, U+040D->i, U+0418->i, U+0419->i, U+0438->i, U+0439->i, U+0456->i, U+1D09->i, U+1D35->i, U+1D4E->i, U+1D62->i, U+1D7B->i, U+1D96->i, U+1DA4->i, U+1DA6->i, U+1DA7->i, U+1E2C->i, U+1E2D->i, U+1E2E->i, U+1E2F->i, U+1EC8->i, U+1EC9->i, U+1ECA->i, U+1ECB->i, U+2071->i, U+2111->i, \
    0..9, A..Z->a..z, _, a..z, \
    U+A8->U+B8, U+B8, U+C0..U+DF->U+E0..U+FF, U+E0..U+FF

    # later (2.1.1)
    # lemmatizer_base = /usr/share/sphinx/dicts/
}


# SPIP
source spip : common
{
        # bibliotheque/more_recherche_spip_article.class.php
        # premier champ = index (obligatoire)

        # surtitre = '' partout
        # descriptif = '' partout
        # chapo = '' partout
        # soustitre = '' partout sauf id = 19
        # ps = '' partout sauf id = 19
        sql_query               = \
                SELECT id_article, titre, texte, date, lang, "spip" AS group_id, CONCAT("spip-", id_article) as main_id \
              FROM spip_articles WHERE statut = "publie"

#       sql_attr_uint           = id_article
        sql_attr_timestamp      = date
        sql_attr_string         = lang
        sql_attr_string         = group_id
        sql_attr_string         = main_id

        sql_field_string        = titre

        sql_query_info          = SELECT * FROM sphinx_doc WHERE id=$id
}

index i_spip : i_common {
        source                  = spip
        path                    = /var/lib/sphinx/spip

    # prefix_fields   = titre, texte
    infix_fields    = titre, texte
}



# PAPYRUS
source papyrus : common
{
    #gm_nom
        #gm_titre
        #gm_titre_alternatif
    #gm_mots_cles                       # TODO
    #gm_description_libre               # TODO
        #gm_description_resume              # TODO
        #gm_description_table_matieres      partout '' sauf gm_id_menu = 1
    #gm_source                          partout '' sauf gm_id_menu = 587
        #gm_auteur                          # TODO
        #gm_contributeur                    # TODO
        #gm_editeur                         # TODO
        #gm_categorie                       # TODO
    #gm_public                          partout ''
    #gmc_contenu
    sql_query = \
        SELECT m.gm_id_menu, \
               IF(gm_nom != '', gm_nom, IF(gm_titre != '', gm_titre, gm_titre_alternatif)) as titre, \
               gmc_contenu AS texte, \
               gm_mots_cles,gm_source, gm_auteur, gm_contributeur, gm_editeur, gm_categorie, \
               \
               gm_date_creation,        \
               "papyrus" AS group_id,    \
               CONCAT("papyrus-", m.gm_id_menu) as main_id \
               \
               FROM gen_menu m \
               LEFT JOIN gen_menu_contenu mc  ON mc.gmc_ce_menu      = m.gm_id_menu \
                                              AND mc.gmc_bool_dernier = 1 \
               WHERE m.gm_date_fin_validite = '0000-00-00 00:00:00' OR LOWER(m.gm_date_fin_validite) < now()

        sql_attr_timestamp      = gm_date_creation
        sql_attr_string         = group_id
        sql_attr_string         = main_id
}

index i_papyrus : i_common {
        source                  = papyrus
        path                    = /var/lib/sphinx/papyrus

    # prefix_fields   = titre, texte
    infix_fields    = titre, texte
}



# PROJET
source projet : common {
    # p_id
    # p_titre
    # p_resume
    # p_description
    # pd_nom            # erreur dans more_recherche_projet.class.php
    # pd_description    # erreur dans more_recherche_projet.class.php
        sql_query               = \
        SELECT p_id, p_titre AS titre, p_description AS texte, \
               p_resume, \
               p_date_creation, \
               "projet" AS group_id,    \
               CONCAT("projet-", p_id) as main_id \
        FROM projet

        sql_attr_timestamp      = p_date_creation
        sql_attr_string         = group_id
        sql_attr_string         = main_id
}

index i_projet : i_common {
        source                  = projet
        path                    = /var/lib/sphinx/projet

    # prefix_fields   = titre, texte
    infix_fields    = titre, texte
}



# BAZAR
source bazar : common {
        sql_query               = \
        SELECT bf_id_fiche, bf_description AS texte, bf_titre AS titre, bf_date_debut_evenement, "bazar" AS group_id, \
        CONCAT("bazar-", bf_id_fiche) as main_id \
        FROM bazar_fiche

        sql_attr_timestamp      = bf_date_debut_evenement
        sql_attr_string         = group_id
        sql_attr_string         = main_id
}




# misc...
index i_bazar : i_common {
        source                  = bazar
        path                    = /var/lib/sphinx/bazar

    # prefix_fields   = titre, texte
    infix_fields    = titre, texte
}

index testrt
{
        type                    = rt
        rt_mem_limit            = 32M

        path                    = /var/lib/sphinx/testrt
        charset_type            = utf-8

        rt_field                = title
        rt_field                = content
        rt_attr_uint            = gid
}


indexer
{
        mem_limit               = 32M
}


searchd
{
        listen                  = 127.0.0.1:9312
        listen                  = 9306:mysql41
        log                     = /var/log/sphinx/sphinx-searchd.log
        query_log               = /var/log/sphinx/sphinx-query.log
        read_timeout            = 5
        max_children            = 30
        pid_file                = /run/sphinx/sphinx-searchd.pid
        max_matches             = 1000
        seamless_rotate         = 1
        preopen_indexes         = 1
        unlink_old              = 1
        workers                 = threads # for RT to work
        binlog_path             = /var/lib/sphinx

    collation_server = utf8_general_ci  # unsure
    collation_libc_locale = fr_FR.UTF-8
    # collation_libc_locale = fr_FR@euro
    # collation_libc_locale = fr_FR@euro
}




# sudo sphinx-searchd --stop -c sphinx-min.conf; sleep 2; sudo sphinx-indexer -c sphinx-min.conf i_projet; sphinx-search -q -c sphinx-min.conf -i i_projet "@texte homogé*"
# sudo sphinx-searchd -c sphinx-min.conf