Subversion Repositories Applications.papyrus

Rev

Rev 2134 | 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                = telabotap
        sql_pass                =
        sql_db                  = tela_prod_v4
        sql_sock                = /run/mysqld/mysqld.sock
        
    sql_query_pre   = SET NAMES utf8
    sql_query_pre   = SET CHARACTER_SET_RESULTS=utf8

    sql_query       = SELECT 1
}

index i_common
{
    # ces deux directive permettent à la source abstraite d'être valide
    # lors de l'utilisation de sphinx-search sans précision d'index
        source                  = common
        path                    = /var/lib/sphinxsearch/void
        docinfo                 = extern
        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 tela_prod_v4<<<"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_type    = utf-8
    # valeur par défaut, cf http://sphinxsearch.com/docs/archives/1.10/conf-charset-table.html
    # pour écraser i_common
    charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F, \
            U+041..U+05a, U+0c6, U+0d0, U+0d8, U+110, U+126, U+132, U+13f, U+141, U+14a, \
                U+152, U+166, U+181, U+186, U+187, U+18a, U+18e..U+190, U+193, U+198, U+19f, U+1a2, \
                U+1b3, U+1c4, U+1c7, U+1ca, U+1e4, U+21c, U+061->U+041, U+0c0->U+041, U+0c1->U+041, \
                U+0c2->U+041, U+0c3->U+041, U+0c4->U+041, U+0c5->U+041, U+0e0->U+041, U+0e1->U+041, \
                U+0e2->U+041, U+0e3->U+041, U+0e4->U+041, U+0e5->U+041, U+100->U+041, U+101->U+041, \
                U+102->U+041, U+103->U+041, U+104->U+041, U+105->U+041, U+1cd->U+041, U+1ce->U+041, \
                U+1de->U+041, U+1df->U+041, U+1e0->U+041, U+1e1->U+041, U+1fa->U+041, U+1fb->U+041, \
                U+200->U+041, U+201->U+041, U+202->U+041, U+203->U+041, U+226->U+041, U+227->U+041, \
                U+1e01->U+041, U+1ea0->U+041, U+1ea1->U+041, U+1ea2->U+041, U+1ea3->U+041, \
                U+1ea4->U+041, U+1ea5->U+041, U+1ea6->U+041, U+1ea7->U+041, U+1ea8->U+041, \
                U+1ea9->U+041, U+1eaa->U+041, U+1eab->U+041, U+1eac->U+041, U+1ead->U+041, \
                U+1eae->U+041, U+1eaf->U+041, U+1eb0->U+041, U+1eb1->U+041, U+1eb2->U+041, \
                U+1eb3->U+041, U+1eb4->U+041, U+1eb5->U+041, U+1eb6->U+041, U+1eb7->U+041, \
                U+062->U+042, U+1e02->U+042, U+1e03->U+042, U+1e04->U+042, U+1e05->U+042, \
                U+1e06->U+042, U+1e07->U+042, U+063->U+043, U+0c7->U+043, U+0e7->U+043, \
                U+106->U+043, U+107->U+043, U+108->U+043, U+109->U+043, U+10a->U+043, U+10b->U+043, \
                U+10c->U+043, U+10d->U+043, U+1e08->U+043, U+1e09->U+043, U+064->U+044, \
                U+10e->U+044, U+10f->U+044, U+1e0a->U+044, U+1e0b->U+044, U+1e0c->U+044, \
                U+1e0d->U+044, U+1e0e->U+044, U+1e0f->U+044, U+1e10->U+044, U+1e11->U+044, \
                U+1e12->U+044, U+1e13->U+044, U+065->U+045, U+0c8->U+045, U+0c9->U+045, \
                U+0ca->U+045, U+0cb->U+045, U+0e8->U+045, U+0e9->U+045, U+0ea->U+045, U+0eb->U+045, \
                U+112->U+045, U+113->U+045, U+114->U+045, U+115->U+045, U+116->U+045, U+117->U+045, \
                U+118->U+045, U+119->U+045, U+11a->U+045, U+11b->U+045, U+204->U+045, U+205->U+045, \
                U+206->U+045, U+207->U+045, U+228->U+045, U+229->U+045, U+1e14->U+045, \
                U+1e15->U+045, U+1e16->U+045, U+1e17->U+045, U+1e18->U+045, U+1e19->U+045, \
                U+1e1a->U+045, U+1e1b->U+045, U+1e1c->U+045, U+1e1d->U+045, U+1eb8->U+045, \
                U+1eb9->U+045, U+1eba->U+045, U+1ebb->U+045, U+1ebc->U+045, U+1ebd->U+045, \
                U+1ebe->U+045, U+1ebf->U+045, U+1ec0->U+045, U+1ec1->U+045, U+1ec2->U+045, \
                U+1ec3->U+045, U+1ec4->U+045, U+1ec5->U+045, U+1ec6->U+045, U+1ec7->U+045, \
                U+066->U+046, U+1e1e->U+046, U+1e1f->U+046, U+067->U+047, U+11c->U+047, \
                U+11d->U+047, U+11e->U+047, U+11f->U+047, U+120->U+047, U+121->U+047, U+122->U+047, \
                U+123->U+047, U+1e6->U+047, U+1e7->U+047, U+1f4->U+047, U+1f5->U+047, \
                U+1e20->U+047, U+1e21->U+047, U+068->U+048, U+124->U+048, U+125->U+048, \
                U+21e->U+048, U+21f->U+048, U+1e22->U+048, U+1e23->U+048, U+1e24->U+048, \
                U+1e25->U+048, U+1e26->U+048, U+1e27->U+048, U+1e28->U+048, U+1e29->U+048, \
                U+1e2a->U+048, U+1e2b->U+048, U+1e96->U+048, U+069->U+049, U+0cc->U+049, \
                U+0cd->U+049, U+0ce->U+049, U+0cf->U+049, U+0ec->U+049, U+0ed->U+049, U+0ee->U+049, \
                U+0ef->U+049, U+128->U+049, U+129->U+049, U+12a->U+049, U+12b->U+049, U+12c->U+049, \
                U+12d->U+049, U+12e->U+049, U+12f->U+049, U+130->U+049, U+131->U+049, U+1cf->U+049, \
                U+1d0->U+049, U+208->U+049, U+209->U+049, U+20a->U+049, U+20b->U+049, \
                U+1e2c->U+049, U+1e2d->U+049, U+1e2e->U+049, U+1e2f->U+049, U+1ec8->U+049, \
                U+1ec9->U+049, U+1eca->U+049, U+1ecb->U+049, U+06a->U+04a, U+134->U+04a, \
                U+135->U+04a, U+1f0->U+04a, U+06b->U+04b, U+136->U+04b, U+137->U+04b, U+1e8->U+04b, \
                U+1e9->U+04b, U+1e30->U+04b, U+1e31->U+04b, U+1e32->U+04b, U+1e33->U+04b, \
                U+1e34->U+04b, U+1e35->U+04b, U+06c->U+04c, U+139->U+04c, U+13a->U+04c, \
                U+13b->U+04c, U+13c->U+04c, U+13d->U+04c, U+13e->U+04c, U+1e36->U+04c, \
                U+1e37->U+04c, U+1e38->U+04c, U+1e39->U+04c, U+1e3a->U+04c, U+1e3b->U+04c, \
                U+1e3c->U+04c, U+1e3d->U+04c, U+06d->U+04d, U+1e3e->U+04d, U+1e3f->U+04d, \
                U+1e40->U+04d, U+1e41->U+04d, U+1e42->U+04d, U+1e43->U+04d, U+06e->U+04e, \
                U+0d1->U+04e, U+0f1->U+04e, U+143->U+04e, U+144->U+04e, U+145->U+04e, U+146->U+04e, \
                U+147->U+04e, U+148->U+04e, U+1f8->U+04e, U+1f9->U+04e, U+1e44->U+04e, \
                U+1e45->U+04e, U+1e46->U+04e, U+1e47->U+04e, U+1e48->U+04e, U+1e49->U+04e, \
                U+1e4a->U+04e, U+1e4b->U+04e, U+06f->U+04f, U+0d2->U+04f, U+0d3->U+04f, \
                U+0d4->U+04f, U+0d5->U+04f, U+0d6->U+04f, U+0f2->U+04f, U+0f3->U+04f, U+0f4->U+04f, \
                U+0f5->U+04f, U+0f6->U+04f, U+14c->U+04f, U+14d->U+04f, U+14e->U+04f, U+14f->U+04f, \
                U+150->U+04f, U+151->U+04f, U+1a0->U+04f, U+1a1->U+04f, U+1d1->U+04f, U+1d2->U+04f, \
                U+1ea->U+04f, U+1eb->U+04f, U+1ec->U+04f, U+1ed->U+04f, U+20c->U+04f, U+20d->U+04f, \
                U+20e->U+04f, U+20f->U+04f, U+22a->U+04f, U+22b->U+04f, U+22c->U+04f, U+22d->U+04f, \
                U+22e->U+04f, U+22f->U+04f, U+230->U+04f, U+231->U+04f, U+1e4c->U+04f, \
                U+1e4d->U+04f, U+1e4e->U+04f, U+1e4f->U+04f, U+1e50->U+04f, U+1e51->U+04f, \
                U+1e52->U+04f, U+1e53->U+04f, U+1ecc->U+04f, U+1ecd->U+04f, U+1ece->U+04f, \
                U+1ecf->U+04f, U+1ed0->U+04f, U+1ed1->U+04f, U+1ed2->U+04f, U+1ed3->U+04f, \
                U+1ed4->U+04f, U+1ed5->U+04f, U+1ed6->U+04f, U+1ed7->U+04f, U+1ed8->U+04f, \
                U+1ed9->U+04f, U+1eda->U+04f, U+1edb->U+04f, U+1edc->U+04f, U+1edd->U+04f, \
                U+1ede->U+04f, U+1edf->U+04f, U+1ee0->U+04f, U+1ee1->U+04f, U+1ee2->U+04f, \
                U+1ee3->U+04f, U+070->U+050, U+1e54->U+050, U+1e55->U+050, U+1e56->U+050, \
                U+1e57->U+050, U+071->U+051, U+072->U+052, U+154->U+052, U+155->U+052, \
                U+156->U+052, U+157->U+052, U+158->U+052, U+159->U+052, U+210->U+052, U+211->U+052, \
                U+212->U+052, U+213->U+052, U+1e58->U+052, U+1e59->U+052, U+1e5a->U+052, \
                U+1e5b->U+052, U+1e5c->U+052, U+1e5d->U+052, U+1e5e->U+052, U+1e5f->U+052, \
                U+073->U+053, U+0df->U+053, U+15a->U+053, U+15b->U+053, U+15c->U+053, U+15d->U+053, \
                U+15e->U+053, U+15f->U+053, U+160->U+053, U+161->U+053, U+17f->U+053, U+218->U+053, \
                U+219->U+053, U+1e60->U+053, U+1e61->U+053, U+1e62->U+053, U+1e63->U+053, \
                U+1e64->U+053, U+1e65->U+053, U+1e66->U+053, U+1e67->U+053, U+1e68->U+053, \
                U+1e69->U+053, U+1e9b->U+053, U+074->U+054, U+162->U+054, U+163->U+054, \
                U+164->U+054, U+165->U+054, U+21a->U+054, U+21b->U+054, U+1e6a->U+054, \
                U+1e6b->U+054, U+1e6c->U+054, U+1e6d->U+054, U+1e6e->U+054, U+1e6f->U+054, \
                U+1e70->U+054, U+1e71->U+054, U+1e97->U+054, U+075->U+055, U+0d9->U+055, \
                U+0da->U+055, U+0db->U+055, U+0dc->U+055, U+0f9->U+055, U+0fa->U+055, U+0fb->U+055, \
                U+0fc->U+055, U+168->U+055, U+169->U+055, U+16a->U+055, U+16b->U+055, U+16c->U+055, \
                U+16d->U+055, U+16e->U+055, U+16f->U+055, U+170->U+055, U+171->U+055, U+172->U+055, \
                U+173->U+055, U+1af->U+055, U+1b0->U+055, U+1d3->U+055, U+1d4->U+055, U+1d5->U+055, \
                U+1d6->U+055, U+1d7->U+055, U+1d8->U+055, U+1d9->U+055, U+1da->U+055, U+1db->U+055, \
                U+1dc->U+055, U+214->U+055, U+215->U+055, U+216->U+055, U+217->U+055, \
                U+1e72->U+055, U+1e73->U+055, U+1e74->U+055, U+1e75->U+055, U+1e76->U+055, \
                U+1e77->U+055, U+1e78->U+055, U+1e79->U+055, U+1e7a->U+055, U+1e7b->U+055, \
                U+1ee4->U+055, U+1ee5->U+055, U+1ee6->U+055, U+1ee7->U+055, U+1ee8->U+055, \
                U+1ee9->U+055, U+1eea->U+055, U+1eeb->U+055, U+1eec->U+055, U+1eed->U+055, \
                U+1eee->U+055, U+1eef->U+055, U+1ef0->U+055, U+1ef1->U+055, U+076->U+056, \
                U+1e7c->U+056, U+1e7d->U+056, U+1e7e->U+056, U+1e7f->U+056, U+077->U+057, \
                U+174->U+057, U+175->U+057, U+1e80->U+057, U+1e81->U+057, U+1e82->U+057, \
                U+1e83->U+057, U+1e84->U+057, U+1e85->U+057, U+1e86->U+057, U+1e87->U+057, \
                U+1e88->U+057, U+1e89->U+057, U+1e98->U+057, U+078->U+058, U+1e8a->U+058, \
                U+1e8b->U+058, U+1e8c->U+058, U+1e8d->U+058, U+079->U+059, U+0dd->U+059, \
                U+0fd->U+059, U+0ff->U+059, U+176->U+059, U+177->U+059, U+178->U+059, U+232->U+059, \
                U+233->U+059, U+1e8e->U+059, U+1e8f->U+059, U+1e99->U+059, U+1ef2->U+059, \
                U+1ef3->U+059, U+1ef4->U+059, U+1ef5->U+059, U+1ef6->U+059, U+1ef7->U+059, \
                U+1ef8->U+059, U+1ef9->U+059, U+07a->U+05a, U+179->U+05a, U+17a->U+05a, \
                U+17b->U+05a, U+17c->U+05a, U+17d->U+05a, U+17e->U+05a, U+1e90->U+05a, \
                U+1e91->U+05a, U+1e92->U+05a, U+1e93->U+05a, U+1e94->U+05a, U+1e95->U+05a, \
                U+0e6->U+0c6, U+1e2->U+0c6, U+1e3->U+0c6, U+1fc->U+0c6, U+1fd->U+0c6, U+0f0->U+0d0, \
                U+0f8->U+0d8, U+1fe->U+0d8, U+1ff->U+0d8, U+111->U+110, U+127->U+126, U+133->U+132, \
                U+140->U+13f, U+142->U+141, U+14b->U+14a, U+153->U+152, U+167->U+166, U+253->U+181, \
                U+254->U+186, U+188->U+187, U+257->U+18a, U+1dd->U+18e, U+259->U+18f, U+25b->U+190, \
                U+260->U+193, U+199->U+198, U+275->U+19f, U+1a3->U+1a2, U+1b4->U+1b3, U+1c5->U+1c4, \
                U+1c6->U+1c4, U+1c8->U+1c7, U+1c9->U+1c7, U+1cb->U+1ca, U+1cc->U+1ca, U+1e5->U+1e4, \
                U+1f2->U+1f1, U+1f3->U+1f1, U+21d->U+21c




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


# SPIP
source spip : common
{
        # sql_db = tela_prod_spip_actu
        # 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, UNIX_TIMESTAMP(date) AS 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_field_string        = group_id      # sql field pour permettre du filtrage @group_id != spip par exemple
        sql_attr_string         = main_id

        sql_field_string        = titre

        sql_query_info          = SELECT * FROM spip_articles WHERE id_article=$id
}

index i_spip : i_common {
        source                  = spip
        path                    = /var/lib/sphinxsearch/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, \
               \
               UNIX_TIMESTAMP(gm_date_creation) AS date,        \
               "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      = date
        sql_field_string        = group_id
        sql_attr_string         = main_id

        sql_query_info          = SELECT * FROM gen_menu WHERE gm_id_menu=$id
}

index i_papyrus : i_common {
        source                  = papyrus
        path                    = /var/lib/sphinxsearch/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, \
               UNIX_TIMESTAMP(p_date_creation) AS date, \
               "projet" AS group_id,    \
               CONCAT("projet-", p_id) as main_id \
        FROM projet

        sql_attr_timestamp      = date
        sql_field_string        = group_id
        sql_attr_string         = main_id

        sql_query_info          = SELECT * FROM projet WHERE p_id=$id
}

index i_projet : i_common {
        source                  = projet
        path                    = /var/lib/sphinxsearch/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, UNIX_TIMESTAMP(bf_date_debut_evenement) AS date, \
        "bazar" AS group_id, CONCAT("bazar-", bf_id_fiche) as main_id \
        FROM bazar_fiche

        sql_attr_timestamp      = date
        sql_field_string        = group_id
        sql_attr_string         = main_id

        sql_query_info          = SELECT * FROM bazar_fiche WHERE bf_id_fiche=$id
}

index i_bazar : i_common {
        source                  = bazar
        path                    = /var/lib/sphinxsearch/bazar

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



# COSTE
source coste : common {
        sql_db                  = tb_eflore

        sql_query               = \
        SELECT c.flore_bdtfx_nn AS id, c.nom_sci AS titre, dsc.body AS texte, cle.body AS determination, \
        "coste" AS group_id, CONCAT("coste-", c.flore_bdtfx_nn) as main_id      \
        FROM tb_eflore.coste_v2_00 c \
        LEFT JOIN tela_prod_wikini.florecoste_pages dsc ON c.page_wiki_dsc = dsc.tag AND dsc.latest = 'Y' \
        LEFT JOIN tela_prod_wikini.florecoste_pages cle ON c.page_wiki_cle = cle.tag AND cle.latest = 'Y' \
        WHERE c.flore_bdtfx_nn != ''

        sql_field_string        = group_id
        sql_attr_string         = main_id

        sql_query_info  = SELECT * FROM coste_v2_00  WHERE flore_bdtfx_nn=$id
}

index i_coste : i_common {
        source                  = coste
        path                    = /var/lib/sphinxsearch/coste

    infix_fields    = texte, titre
}



# NVJFL
source nvjfl : common {
        sql_db                  = tb_eflore

    # note: 66 taxons nvjfl n'ont pas de numéro nomenclatural
        sql_query               = \
        SELECT b.num_nom, num_taxon, nom_sci AS titre, GROUP_CONCAT(DISTINCT nom_vernaculaire) AS texte, \
        "nvjfl" AS group_id, CONCAT("nvjfl-", b.num_nom) as main_id     \
        FROM nvjfl_v2007 n \
        LEFT JOIN bdtfx_v1_01 b ON n.num_taxon = b.num_taxonomique \
        WHERE b.num_nom IS NOT NULL \
        GROUP by num_taxon

        sql_field_string        = titre
        sql_field_string        = texte

        sql_field_string        = group_id
        sql_attr_string         = main_id
    sql_attr_uint       = num_taxon

        sql_query_info  = SELECT * FROM nvjfl_v2007 WHERE num_taxon=$id
}

index i_nvjfl : i_common {
        source                  = nvjfl
        path                    = /var/lib/sphinxsearch/nvjfl

    infix_fields    = texte, titre
}



# noms scientifiques / noms d'auteur BDTFX
source bdtfx : common {
        sql_db                  = tb_eflore

        sql_query               = \
        SELECT b.num_nom, b.nom_sci AS nom_sci, b.auteur AS auteur, \
        "bdtfx" AS group_id, CONCAT("bdtfx-", b.num_nom) as main_id, b.num_nom, \
        CONCAT(bret.nom_sci, ' ', bret.auteur) AS nom_ret \
        FROM bdtfx_v1_01 b LEFT JOIN bdtfx_v1_01 bret ON b.num_nom_retenu = bret.num_nom \
        UNION ALL \
        SELECT a.num_nom + 500000, a.nom_sci, a.auteur, \
        "bdtxa" AS group_id, CONCAT("bdtxa-", a.num_nom) AS main_id, a.num_nom, \
        CONCAT(aret.nom_sci, ' ', aret.auteur) AS nom_ret \
        FROM bdtxa_v1_01 a LEFT JOIN bdtxa_v1_01 aret ON a.num_nom_retenu = aret.num_nom \
        UNION ALL \
        SELECT i.num_nom + 1000000, i.nom_sci, i.auteur, \
        "isfan" AS group_id, CONCAT("isfan-", i.num_nom) AS main_id, i.num_nom, \
        CONCAT(iret.nom_sci, ' ', iret.auteur) AS nom_ret \
        FROM isfan_v2013 i LEFT JOIN isfan_v2013 iret ON i.num_nom_retenu = iret.num_nom

        sql_field_string        = group_id
        sql_field_string        = nom_sci
        sql_field_string        = auteur
        sql_attr_string         = main_id
    sql_attr_uint       = num_nom
    sql_attr_string     = nom_ret

        sql_query_info  = SELECT num_nom, num_nom_retenu, num_tax_sup, rang, nom_sci, genre, auteur, annee, homonyme, nom_francais, num_taxonomique, nom_complet, famille FROM bdtfx_v1_01 \
                          WHERE num_nom=$id UNION \
                          SELECT num_nom, num_nom_retenu, num_tax_sup, rang, nom_sci, genre, auteur, annee, homonyme, nom_francais, num_tax, nom_complet, famille FROM bdtxa_v1_01 \
                          WHERE num_nom=$id UNION \
                          SELECT num_nom, num_nom_retenu, num_tax_sup, rang, nom_sci, genre, auteur, annee, NULL, NULL, num_taxonomique, nom_complet, famille FROM isfan_v2013 \
                          WHERE num_nom=$id
}

index i_bdtfx : i_common {
        source                  = bdtfx
        path                    = /var/lib/sphinxsearch/bdtfx

        stopwords               =
        morphology              =
    infix_fields    = b.nom_sci, b.auteur
        enable_star             = 0
    min_word_len    = 1
    min_prefix_len  = 0
    min_infix_len   = 3

}


# noms scientifiques / noms d'auteur BDTFX2
source bdtfx2 : common {
        sql_db                  = tb_eflore

        sql_query               = \
        SELECT b.num_nom, b.nom_sci AS nom_sci, b.auteur AS auteur, \
        "bdtfx2" AS group_id, CONCAT("bdtfx2-", b.num_nom) as main_id, b.num_nom, \
        CONCAT(bret.nom_sci, ' ', bret.auteur) AS nom_ret \
        FROM bdtfx_v2_00 b LEFT JOIN bdtfx_v2_00 bret ON b.num_nom_retenu = bret.num_nom \
        UNION ALL \
        SELECT a.num_nom + 500000, a.nom_sci, a.auteur, \
        "bdtxa" AS group_id, CONCAT("bdtxa-", a.num_nom) AS main_id, a.num_nom, \
        CONCAT(aret.nom_sci, ' ', aret.auteur) AS nom_ret \
        FROM bdtxa_v1_01 a LEFT JOIN bdtxa_v1_01 aret ON a.num_nom_retenu = aret.num_nom \
        UNION ALL \
        SELECT i.num_nom + 1000000, i.nom_sci, i.auteur, \
        "isfan" AS group_id, CONCAT("isfan-", i.num_nom) AS main_id, i.num_nom, \
        CONCAT(iret.nom_sci, ' ', iret.auteur) AS nom_ret \
        FROM isfan_v2013 i LEFT JOIN isfan_v2013 iret ON i.num_nom_retenu = iret.num_nom

        sql_field_string        = group_id
        sql_field_string        = nom_sci
        sql_field_string        = auteur
        sql_attr_string         = main_id
    sql_attr_uint       = num_nom
    sql_attr_string     = nom_ret

        sql_query_info  = SELECT num_nom, num_nom_retenu, num_tax_sup, rang, nom_sci, genre, auteur, annee, homonyme, nom_francais, num_taxonomique, nom_complet, famille FROM bdtfx_v2_00 \
                          WHERE num_nom=$id UNION \
                          SELECT num_nom, num_nom_retenu, num_tax_sup, rang, nom_sci, genre, auteur, annee, homonyme, nom_francais, num_tax, nom_complet, famille FROM bdtxa_v1_01 \
                          WHERE num_nom=$id UNION \
                          SELECT num_nom, num_nom_retenu, num_tax_sup, rang, nom_sci, genre, auteur, annee, NULL, NULL, num_taxonomique, nom_complet, famille FROM isfan_v2013 \
                          WHERE num_nom=$id
}

index i_bdtfx2 : i_common {
        source                  = bdtfx2
        path                    = /var/lib/sphinxsearch/bdtfx2

        stopwords               =
        morphology              =
    infix_fields    = b.nom_sci, b.auteur
        enable_star             = 0
    min_word_len    = 1
    min_prefix_len  = 0
    min_infix_len   = 3

}



# COSTE / NVJFL
# source costenvjfl : common {
#       sql_db                  = tb_eflore

#       sql_query               = \
#         SELECT c.flore_bdtfx_nn AS id, c.nom_sci AS titre, dsc.body AS texte, cle.body AS determination, \
#         GROUP_CONCAT(n.nom_vernaculaire) AS nvjfl, n.num_taxon AS num_taxonomique, \
#         "costenvjfl" AS group_id, CONCAT("costenvjfl-", c.flore_bdtfx_nn) as main_id  \
#         FROM tb_eflore.coste_v2_00 c \
#         LEFT JOIN tela_prod_wikini.florecoste_pages dsc ON c.page_wiki_dsc = dsc.tag AND dsc.latest = 'Y' \
#         LEFT JOIN tela_prod_wikini.florecoste_pages cle ON c.page_wiki_cle = cle.tag AND cle.latest = 'Y' \
#         LEFT JOIN bdtfx_v1_01 b ON c.flore_bdtfx_nn = b.num_nom \
#         LEFT JOIN nvjfl_v2007 n ON b.num_taxonomique = n.num_taxon \
#         WHERE c.flore_bdtfx_nn != ''

#       sql_field_string        = group_id
#       sql_attr_string         = main_id
#     sql_attr_uint       = num_taxonomique

#       sql_query_info  = SELECT * FROM coste_v2_00  WHERE flore_bdtfx_nn=$id
# }

# index i_costenvjfl : i_common {
#       source                  = costenvjfl
#       path                    = /var/lib/sphinxsearch/costenvjfl

#     infix_fields    = texte, titre
# }

# notes:
# une nouvelle source d'indexation *DOIT*, pour être utilisable par le moteur de recherche papyrus,
# définir les attributs *group_id* et *main_id*.
# cf: sphinx_search dans moteur_recherche_sphinx.php



# misc...
# index testrt
# {
#       type                    = rt
#       rt_mem_limit            = 32M

#       path                    = /var/lib/sphinxsearch/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

    # note: les collations n'affectent pas l'indexation mais seulement
    # les attributs:
    # cf: http://sphinxsearch.com/bugs/view.php?id=1597
    # collation_server = utf8_general_ci
    # collation_libc_locale = fr_FR.UTF-8
    # collation_libc_locale = fr_FR@euro
}


# sudo sphinx-searchd --stopwait -c sphinx-min.conf; 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


# problème de charsets et génération de charset_table pour i_coste:
# + https://raw.github.com/melo/scripts/master/bin/x-sphinx-charset-generator [ moins fiable ]
# $ wget https://raw.github.com/tom--/Collation-to-Charset-Table/master/collation_2_charset_table-{1,2}.php
# $ php collation_2_charset_table-1.php|sed -n -e '/^[A-Z]/p'|php collation_2_charset_table-2.php