diff --git a/1.0/Sphinx.sh b/1.0/Sphinx.sh index a63cc83..41c8137 100755 --- a/1.0/Sphinx.sh +++ b/1.0/Sphinx.sh @@ -1,7 +1,34 @@ #!/bin/bash -#This program as been create by Damien for Scores et decisions ste -#Email : dlasserre@scores-decisions.com + allVersion=("2.0.1" "0.9.9") +declare -A ERREURS +declare -A ASTUCES + +declare -A ASTUCESDEV + +ROUGE="\\033[1;31m" +NORMAL="\\033[0;39m" +CYAN="\\033[1;36m" +VERT="\\033[1;32m" +BOLD="\\033[1m" +UNDERLINE="\\033[4m" +TEXTNONE="\\033[0m" + +#Var +dir="Exist" +log="Exist" +dbs="Exist" +sphinx="Exist" +sphinxlog="Exist" + +ERREURS=( + ["CHMOD"]="Execute the script with SUDO or in ROOT" + ["DIRECTORY"]="Directory not create" + ["CMD"]="This command not exist" + ["NOCMD"]="Please enter options") + +ASTUCES=( + ["CREATE"]="Sphinx --create (prepare l'environement)"); function loadIndication() { while [ -d "/proc/$1" ] @@ -15,11 +42,16 @@ function loadIndication() { if [ `id -u` = 0 ] #Need Root or Sudo then - commande=('--configure' '--install' '--all') + commande=('--install' '--all') for i; do case $i in '--help') - `man SphinxHelp` #en cours de création du man ! + echo -e $ROUGE"*************************************************************************************************************************************"$NORMAL + echo -e "--install version : Vous permet d'installer configurer et crée les indexe et la libstemmer compilation, installation et configuration"; + echo -e "--delete : Vous permet de restaurer les parametres de la machines en supprimer la configuration et l'installation" + echo -e "--version : Vous retournes les dernieres version disponnibles en téléchargement sur Sphinx." + echo -e $ROUGE"**************************************************************************************************************************************"$NORMAL + exit; ;; '--delete') `rm -r indexeConf tmp sphinx-* wget* libste* *~ 2> /dev/null` @@ -31,17 +63,13 @@ then echo -e "2. Past version : 0.9.9\n" ;; '--install') - #Environement for installation - if [ ! -e /dbs ];then `mkdir /dbs`; dbs="Success"; fi - #repertoire temporaire. + if [ ! -e /dbs ];then echo -e "/dbs not exist !"; exit; fi if [ ! -e tmp ];then `mkdir tmp`; fi - ## - - if [ ! -e /dbs/sphinx ];then echo -e "/dbs/sphinx Doesn't exist !"; exit; fi - if [ ! -e /dbs/sphinxlog ];then echo -e "/dbs/sphinxlog Doesn't exist !"; exit; fi - if [ ! -e /usr/local/sphinx ];then echo -e "/usr/local/sphinx Doesn't exist !"; exit; fi - if [ ! -e /init.d/sphinxsearch ];then `cp initscript/sphinxsearch /etc/init.d/; update-rc.d sphinxsearch defaults`; fi - #Check if package in directory, if you want to download manually the package + if [ ! -e /dbs/sphinx ];then `mkdir /dbs/sphinx`; fi + if [ ! -e /usr/local/sphinx ];then `mkdir /dbs/sphinx`; fi + if [ ! -e /dbs/sphinxlog ];then `mkdir /dbs/sphinxlog`; fi + if [ ! -e /init.d/sphinxsearch ];then `cp initscript/sphinxsearch /etc/init.d/ > /dev/null` ;`chmod +x /etc/init.d/sphinxsearch > /dev/null`; `update-rc.d sphinxsearch defaults > /dev/null`; fi + if [ ! -e config/${HOSTNAME} ];then `mkdir config/${HOSTNAME}`;fi if [ ! -e sphinx-2.0.1.tar.gz ] || [ ! -e sphinx-0.9.9.tar.gz ] then if [ ! -z $2 ]; then @@ -87,36 +115,12 @@ then echo -e $NORMAL"- Complited" echo -e $NORMAL echo -e $CYAN"Compilation progress..."$ROUGE - #if [ $version != "2.0.1-beta" ];then `cd tmp/sphinx-$version ; make ` ; - #else - #`cd tmp/sphinx-$version/ ; make install 1> /dev/null`;fi + if [ $version != "2.0.1-beta" ];then `cd tmp/sphinx-$version ; make; make install ` ; + else + `cd tmp/sphinx-$version/ ; make; make install`;fi echo -e $NORMAL" - Complited" - echo -n "Machine MASTER ? (y/n) : "; read response - `touch /usr/local/sphinx/sphinx.conf`; - `cat config/${HOSTNAME}/sphinx.conf > /usr/local/sphinx/sphinx.conf`; - if [ $response = 'y' ];then - echo -e $ROUGE"Mode MASTER activated"$NORMAL - `cat config/${HOSTNAME}/*.conf-MysqlServer >> /usr/local/sphinx/sphinx.conf`; - else - echo -e $ROUGE"Mode SLAVE activated"$NORMAL - `cat config/${HOSTNAME}/*.conf-MysqlServerSlave >> /usr/local/sphinx/sphinx.conf`; - fi - echo -e $VERT"The installation as been finish ! great ! thank's damien :)"$NORMAL - exit - ;; - '--refresh') - echo -n "Machine MASTER ? (y/n) : "; read response - `touch /usr/local/sphinx/sphinx.conf`; - `cat config/${HOSTNAME}/sphinx.conf > /usr/local/sphinx/sphinx.conf`; - if [ $response = 'y' ];then - echo -e $ROUGE"Mode MASTER activated"$NORMAL - `cat config/${HOSTNAME}/*.conf-MysqlServer >> /usr/local/sphinx/sphinx.conf`; - else - echo -e $ROUGE"Mode SLAVE activated"$NORMAL - `cat config/${HOSTNAME}/*.conf-MysqlServerSlave >> /usr/local/sphinx/sphinx.conf`; - fi - echo -e $VERT"The refresh as been finish ! great ! thank's damien :)"$NORMAL - exit + echo -e $VERT"The installation as been finish ! great ! thank's damien :)"$NORMAL + exit ;; *) #Default diff --git a/1.0/config/sdsrvws02/ent.conf-MysqlServer b/1.0/config/Sphinx/MysqlServer/ent.conf similarity index 86% rename from 1.0/config/sdsrvws02/ent.conf-MysqlServer rename to 1.0/config/Sphinx/MysqlServer/ent.conf index 26e4abd..b9f7f15 100644 --- a/1.0/config/sdsrvws02/ent.conf-MysqlServer +++ b/1.0/config/Sphinx/MysqlServer/ent.conf @@ -1,7 +1,7 @@ source source_ent { type = mysql - sql_host = 192.168.3.30 + sql_host = 192.168.78.230 sql_user = sphinx sql_pass = indexer sql_db = jo @@ -34,11 +34,8 @@ index ent source = source_ent path = /dbs/sphinx/ent docinfo = extern - wordforms = /usr/local/sphinx/etc/wordforms.txt - abreviations = /usr/local/sphinx/etc/abreviations.txt - ispell_aff = /usr/local/sphinx/etc/francais.aff charset_type = sbcs charset_table = 0..9, A..Z->a..z, a..z, \ U+23, U+25, U+26, U+2B, U+3D, U+40, \ U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} \ No newline at end of file +} diff --git a/1.0/config/Sphinx/act.conf-MysqlServerSlave b/1.0/config/Sphinx/act.conf-MysqlServerSlave deleted file mode 100644 index 9682316..0000000 --- a/1.0/config/Sphinx/act.conf-MysqlServerSlave +++ /dev/null @@ -1,31 +0,0 @@ -source source_act -{ - type = mysql - sql_host = 192.168.3.30 - sql_user = sphinx - sql_pass = indexer - sql_db = jo - sql_query_pre = - sql_query = SELECT id, Siren1, RaisonSociale, Siren2, actif, dateLien, IF(dateUpdate>dateInsert,dateUpdate,dateInsert) as dateMaj, \ - source, Pmin*1 AS PminNum, MajMin, PpPm, IF(Pays='','FRA',Pays) AS Pays \ - FROM liens \ - WHERE ActionPart=1 AND Siren1>1000 AND Siren1 IN (SELECT DISTINCT SIREN FROM etablissements_old); - sql_attr_uint = actif - sql_attr_uint = source - sql_attr_uint = PminNum - sql_attr_str2ordinal= MajMin - sql_attr_str2ordinal= PpPm - sql_attr_str2ordinal= Pays -} - -index act -{ - source = source_act - path = /dbs/sphinx/act - docinfo = extern - morphology = none - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} \ No newline at end of file diff --git a/1.0/config/Sphinx/cmp.conf-MysqlServer b/1.0/config/Sphinx/cmp.conf-MysqlServer deleted file mode 100644 index d01a87e..0000000 --- a/1.0/config/Sphinx/cmp.conf-MysqlServer +++ /dev/null @@ -1,40 +0,0 @@ - -source comptage -{ - type = mysql - sql_host = 192.168.3.30 - sql_user = root - sql_pass = scores - sql_db = jo - sql_port = 3306 - sql_query = SELECT id,ape_etab,ape_entrep,source,siren,nic,actif,siege,adr_cp,adr_dep,adr_com,(tel>100000000) AS tel,(fax>100000000) AS fax,cj,capital,age_entrep,age_etab,tca,tcaexp,teff_entrep,teff_etab,rang,dateCrea_etab,eff_entrep,eff_etab,nbEtab,bilType,bilAnnee,bilTca,bilCA,bilCAexp,bilRN FROM etablissements_act; - sql_attr_str2ordinal = bilType - sql_attr_uint = source - sql_attr_uint = actif - sql_attr_uint = siege - sql_attr_uint = adr_cp - sql_attr_uint = adr_dep - sql_attr_uint = adr_com - sql_attr_uint = tel - sql_attr_uint = fax - sql_attr_uint = cj - sql_attr_uint = capital - sql_attr_uint = age_entrep - sql_attr_uint = age_etab - sql_attr_uint = tca - sql_attr_uint = tcaexp - sql_attr_uint = teff_entrep - sql_attr_uint = teff_etab - sql_attr_uint = rang - sql_attr_uint = dateCrea_etab - sql_attr_uint = eff_entrep - sql_attr_uint = eff_etab - sql_attr_uint = nbEtab - sql_attr_uint = bilAnnee - sql_attr_uint = bilTca - sql_attr_uint = bilCA - sql_attr_uint = bilCAexp - sql_attr_uint = bilRN - - sql_query_info = SELECT siren, nic, ape_etab,ape_entrep, raisonSociale, enseigne, sigle, adr_libVoie, adr_cp, adr_ville FROM etablissements WHERE id=$id; -} \ No newline at end of file diff --git a/1.0/config/Sphinx/cmp.conf-MysqlServerSlave b/1.0/config/Sphinx/cmp.conf-MysqlServerSlave deleted file mode 100644 index d01a87e..0000000 --- a/1.0/config/Sphinx/cmp.conf-MysqlServerSlave +++ /dev/null @@ -1,40 +0,0 @@ - -source comptage -{ - type = mysql - sql_host = 192.168.3.30 - sql_user = root - sql_pass = scores - sql_db = jo - sql_port = 3306 - sql_query = SELECT id,ape_etab,ape_entrep,source,siren,nic,actif,siege,adr_cp,adr_dep,adr_com,(tel>100000000) AS tel,(fax>100000000) AS fax,cj,capital,age_entrep,age_etab,tca,tcaexp,teff_entrep,teff_etab,rang,dateCrea_etab,eff_entrep,eff_etab,nbEtab,bilType,bilAnnee,bilTca,bilCA,bilCAexp,bilRN FROM etablissements_act; - sql_attr_str2ordinal = bilType - sql_attr_uint = source - sql_attr_uint = actif - sql_attr_uint = siege - sql_attr_uint = adr_cp - sql_attr_uint = adr_dep - sql_attr_uint = adr_com - sql_attr_uint = tel - sql_attr_uint = fax - sql_attr_uint = cj - sql_attr_uint = capital - sql_attr_uint = age_entrep - sql_attr_uint = age_etab - sql_attr_uint = tca - sql_attr_uint = tcaexp - sql_attr_uint = teff_entrep - sql_attr_uint = teff_etab - sql_attr_uint = rang - sql_attr_uint = dateCrea_etab - sql_attr_uint = eff_entrep - sql_attr_uint = eff_etab - sql_attr_uint = nbEtab - sql_attr_uint = bilAnnee - sql_attr_uint = bilTca - sql_attr_uint = bilCA - sql_attr_uint = bilCAexp - sql_attr_uint = bilRN - - sql_query_info = SELECT siren, nic, ape_etab,ape_entrep, raisonSociale, enseigne, sigle, adr_libVoie, adr_cp, adr_ville FROM etablissements WHERE id=$id; -} \ No newline at end of file diff --git a/1.0/config/Sphinx/dir.conf-MysqlServer b/1.0/config/Sphinx/dir.conf-MysqlServer deleted file mode 100644 index be3e753..0000000 --- a/1.0/config/Sphinx/dir.conf-MysqlServer +++ /dev/null @@ -1,45 +0,0 @@ -source source_dir -{ - type = mysql - sql_host = 192.168.3.30 - sql_user = sphinx - sql_pass = indexer - sql_db = jo - sql_query_pre = - sql_query = SELECT id, siren, actif, \ -IF(civilite='M',1,IF(civilite='MME' OR civilite='MLLE',2,0)) AS genre, \ -CONCAT(nom,' ',naissance_nom, ' ', dirRS) AS nom, prenom, \ - YEAR(naissance_date) AS naiss_annee, \ -MONTH(naissance_date) AS naiss_mois, \ - DAY(naissance_date) AS naiss_jour, \ -naissance_lieu, adr_dep \ -FROM rncs_dirigeants; -# UNION \ -#SELECT id, siren, 0 AS actif, \ -#'' AS genre, \ -#CONCAT(nom,' ',nomUsage,' ',rs) AS nom, prenom, \ -#0 AS naiss_annee, \ -#0 AS naiss_mois, \ -#0 AS naiss_jour, \ -#'' AS naissance_lieu, 0 AS adr_dep \ -#FROM bodacc_dirigeants_histo; - sql_attr_uint = naiss_annee - sql_attr_uint = naiss_mois - sql_attr_uint = naiss_jour - sql_attr_uint = actif - sql_attr_uint = genre - sql_attr_uint = adr_dep -} - -index dir -{ - source = source_dir - path = /dbs/sphinx/dir - docinfo = extern - morphology = none - #ispell_aff = /usr/local/sphinx/etc/francais.aff - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} \ No newline at end of file diff --git a/1.0/config/Sphinx/dir.conf-MysqlServerSlave b/1.0/config/Sphinx/dir.conf-MysqlServerSlave deleted file mode 100644 index be3e753..0000000 --- a/1.0/config/Sphinx/dir.conf-MysqlServerSlave +++ /dev/null @@ -1,45 +0,0 @@ -source source_dir -{ - type = mysql - sql_host = 192.168.3.30 - sql_user = sphinx - sql_pass = indexer - sql_db = jo - sql_query_pre = - sql_query = SELECT id, siren, actif, \ -IF(civilite='M',1,IF(civilite='MME' OR civilite='MLLE',2,0)) AS genre, \ -CONCAT(nom,' ',naissance_nom, ' ', dirRS) AS nom, prenom, \ - YEAR(naissance_date) AS naiss_annee, \ -MONTH(naissance_date) AS naiss_mois, \ - DAY(naissance_date) AS naiss_jour, \ -naissance_lieu, adr_dep \ -FROM rncs_dirigeants; -# UNION \ -#SELECT id, siren, 0 AS actif, \ -#'' AS genre, \ -#CONCAT(nom,' ',nomUsage,' ',rs) AS nom, prenom, \ -#0 AS naiss_annee, \ -#0 AS naiss_mois, \ -#0 AS naiss_jour, \ -#'' AS naissance_lieu, 0 AS adr_dep \ -#FROM bodacc_dirigeants_histo; - sql_attr_uint = naiss_annee - sql_attr_uint = naiss_mois - sql_attr_uint = naiss_jour - sql_attr_uint = actif - sql_attr_uint = genre - sql_attr_uint = adr_dep -} - -index dir -{ - source = source_dir - path = /dbs/sphinx/dir - docinfo = extern - morphology = none - #ispell_aff = /usr/local/sphinx/etc/francais.aff - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} \ No newline at end of file diff --git a/1.0/config/Sphinx/ent.conf-MysqlServer b/1.0/config/Sphinx/ent.conf-MysqlServer deleted file mode 100644 index 26e4abd..0000000 --- a/1.0/config/Sphinx/ent.conf-MysqlServer +++ /dev/null @@ -1,44 +0,0 @@ -source source_ent -{ - type = mysql - sql_host = 192.168.3.30 - sql_user = sphinx - sql_pass = indexer - sql_db = jo - sql_query_pre = - sql_query = SELECT id, siren, nic, siege, CONCAT(raisonSociale,\ -' "" ',enseigne,' "" ',sigle,' "" ',identite_pre,' "" ',\ -REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(sigle,' ',''),\ -'@','A'), '&',' ET '),'/',''),',',''),'-',''),'.',''),' ',\ -REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(sigle,\ -'@','A'), '&',' ET '),'/',''),',',''),'-',''),'.','')) AS nom, adr_dep, \ -actif, adr_num, adr_typeVoie, CONCAT(adr_libVoie,' ',adr_comp) AS adresse, adr_cp, \ -adr_ville AS ville, cj, ape_etab, (siren>200) AS sirenValide, rang \ -FROM etablissements_tmp; - sql_attr_str2ordinal = adr_typeVoie - sql_attr_uint = siren - sql_attr_uint = nic - sql_attr_uint = siege - sql_attr_uint = adr_num - sql_attr_uint = adr_cp - sql_attr_uint = adr_dep - sql_attr_uint = actif - sql_attr_uint = cj - sql_attr_uint = sirenValide - sql_attr_uint = rang - -} - -index ent -{ - source = source_ent - path = /dbs/sphinx/ent - docinfo = extern - wordforms = /usr/local/sphinx/etc/wordforms.txt - abreviations = /usr/local/sphinx/etc/abreviations.txt - ispell_aff = /usr/local/sphinx/etc/francais.aff - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} \ No newline at end of file diff --git a/1.0/config/Sphinx/ent.conf-MysqlServerSlave b/1.0/config/Sphinx/ent.conf-MysqlServerSlave deleted file mode 100644 index 84d34ac..0000000 --- a/1.0/config/Sphinx/ent.conf-MysqlServerSlave +++ /dev/null @@ -1,44 +0,0 @@ -source source_ent -{ - type = mysql - sql_host = 192.168.3.30 - sql_user = sphinx - sql_pass = indexer - sql_db = jo - sql_query_pre = - sql_query = SELECT id, siren, nic, siege, CONCAT(raisonSociale,\ -' "" ',enseigne,' "" ',sigle,' "" ',identite_pre,' "" ',\ -REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(sigle,' ',''),\ -'@','A'), '&',' ET '),'/',''),',',''),'-',''),'.',''),' ',\ -REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(sigle,\ -'@','A'), '&',' ET '),'/',''),',',''),'-',''),'.','')) AS nom, adr_dep, \ -actif, adr_num, adr_typeVoie, CONCAT(adr_libVoie,' ',adr_comp) AS adresse, adr_cp, \ -adr_ville AS ville, cj, ape_etab, (siren>200) AS sirenValide, rang \ -FROM etablissements; - sql_attr_str2ordinal = adr_typeVoie - sql_attr_uint = siren - sql_attr_uint = nic - sql_attr_uint = siege - sql_attr_uint = adr_num - sql_attr_uint = adr_cp - sql_attr_uint = adr_dep - sql_attr_uint = actif - sql_attr_uint = cj - sql_attr_uint = sirenValide - sql_attr_uint = rang - -} - -index ent -{ - source = source_ent - path = /dbs/sphinx/ent - docinfo = extern - wordforms = /usr/local/sphinx/etc/wordforms.txt - abreviations = /usr/local/sphinx/etc/abreviations.txt - ispell_aff = /usr/local/sphinx/etc/francais.aff - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} \ No newline at end of file diff --git a/1.0/config/Sphinx/histo.conf-MysqlServer b/1.0/config/Sphinx/histo.conf-MysqlServer deleted file mode 100644 index 29473ad..0000000 --- a/1.0/config/Sphinx/histo.conf-MysqlServer +++ /dev/null @@ -1,39 +0,0 @@ -# -# Sphinx configuration file sample -# -# WARNING! While this sample file mentions all available options, -# it contains (very) short helper descriptions only. Please refer to -# doc/sphinx.html for details. -# - -############################################################################# -## data source definition -############################################################################# - -source histo -{ - type = mysql - sql_host = 192.168.78.230 - sql_user = sphinx_histo - sql_pass = sphinx - sql_db = histobodacc - sql_port = 3306 # optional, default is 3306 - sql_query = SELECT id, nomFichier, annee1, dateBod, texte FROM bodacc_ocr; - sql_attr_uint = annee1 - sql_query_info = SELECT * FROM bodacc_ocr WHERE id=$id -} - -############################################################################# -## index definition -############################################################################# - -index histo -{ - source = histo - path = /home/sphinx/histo - docinfo = extern - morphology = none - min_word_len = 1 - charset_type = sbcs - html_strip = 1 -} diff --git a/1.0/config/Sphinx/sphinx.conf b/1.0/config/Sphinx/sphinx.conf index b390725..36fd0cf 100644 --- a/1.0/config/Sphinx/sphinx.conf +++ b/1.0/config/Sphinx/sphinx.conf @@ -7,7 +7,7 @@ indexer { # memory limit, in bytes, kiloytes (16384K) or megabytes (256M) # optional, default is 32M, max is 2047M, recommended is 256M to 1024M - mem_limit = 256 + mem_limit = 2047M # maximum IO calls per second (for I/O throttling) # optional, default is 0 (unlimited) @@ -65,7 +65,7 @@ searchd # seamless rotate, prevents rotate stalls if precaching huge datasets # optional, default is 1 - seamless_rotate = 0 + seamless_rotate = 1 # whether to forcibly preopen all indexes on startup # optional, default is 0 (do not preopen) diff --git a/1.0/config/Sphinx/act.conf-MysqlServer b/1.0/config/SphinxHisto/MysqlServer/act.conf similarity index 99% rename from 1.0/config/Sphinx/act.conf-MysqlServer rename to 1.0/config/SphinxHisto/MysqlServer/act.conf index 9682316..990ea7b 100644 --- a/1.0/config/Sphinx/act.conf-MysqlServer +++ b/1.0/config/SphinxHisto/MysqlServer/act.conf @@ -28,4 +28,4 @@ index act charset_table = 0..9, A..Z->a..z, a..z, \ U+23, U+25, U+26, U+2B, U+3D, U+40, \ U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} \ No newline at end of file +} diff --git a/1.0/config/sdsrvws02/dir.conf-MysqlServer b/1.0/config/SphinxHisto/MysqlServer/dir.conf similarity index 99% rename from 1.0/config/sdsrvws02/dir.conf-MysqlServer rename to 1.0/config/SphinxHisto/MysqlServer/dir.conf index be3e753..bd52a74 100644 --- a/1.0/config/sdsrvws02/dir.conf-MysqlServer +++ b/1.0/config/SphinxHisto/MysqlServer/dir.conf @@ -42,4 +42,4 @@ index dir charset_table = 0..9, A..Z->a..z, a..z, \ U+23, U+25, U+26, U+2B, U+3D, U+40, \ U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} \ No newline at end of file +} diff --git a/1.0/config/sdsrvws02/histo.conf-MysqlServer b/1.0/config/SphinxHisto/MysqlServer/histo.conf similarity index 58% rename from 1.0/config/sdsrvws02/histo.conf-MysqlServer rename to 1.0/config/SphinxHisto/MysqlServer/histo.conf index 29473ad..ee22bf6 100644 --- a/1.0/config/sdsrvws02/histo.conf-MysqlServer +++ b/1.0/config/SphinxHisto/MysqlServer/histo.conf @@ -1,16 +1,4 @@ -# -# Sphinx configuration file sample -# -# WARNING! While this sample file mentions all available options, -# it contains (very) short helper descriptions only. Please refer to -# doc/sphinx.html for details. -# - -############################################################################# -## data source definition -############################################################################# - -source histo +ource histo { type = mysql sql_host = 192.168.78.230 @@ -23,10 +11,6 @@ source histo sql_query_info = SELECT * FROM bodacc_ocr WHERE id=$id } -############################################################################# -## index definition -############################################################################# - index histo { source = histo diff --git a/1.0/config/SphinxHisto/act.conf-MysqlServer b/1.0/config/SphinxHisto/act.conf-MysqlServer deleted file mode 100644 index 9b9e2bf..0000000 --- a/1.0/config/SphinxHisto/act.conf-MysqlServer +++ /dev/null @@ -1,40 +0,0 @@ - -source source_act -{ - type = mysql - sql_host = 192.168.3.30 - sql_user = sphinx - sql_pass = indexer - sql_db = jo - sql_query_pre = - sql_query = SELECT id, Siren1, RaisonSociale, Siren2, actif, dateLien, IF(dateUpdate > dateInsert, dateUpdate,dateInsert) as dateMaj, source, Pmin*1 AS PminNum, MajMin, PpPm, IF(Pays='','FRA',Pays) AS Pays FROM liens WHERE ActionPart=1 AND Siren1>1000 AND Siren1 IN (SELECT DISTINCT SIREN FROM etablissements_old); - sql_attr_uint = actif - sql_attr_uint = source - sql_attr_uint = PminNum - sql_attr_str2ordinal= MajMin - sql_attr_str2ordinal= PpPm -} - -index act -{ - source = source_act - path = /dbs/sphinx/act - docinfo = extern - morphology = none - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} - -index act_phx -{ - source = source_act - path = /dbs/sphinx/act_phx - docinfo = extern - morphology = libstemmer_francais - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} \ No newline at end of file diff --git a/1.0/config/SphinxHisto/act.conf-MysqlServerSlave b/1.0/config/SphinxHisto/act.conf-MysqlServerSlave deleted file mode 100644 index 9b9e2bf..0000000 --- a/1.0/config/SphinxHisto/act.conf-MysqlServerSlave +++ /dev/null @@ -1,40 +0,0 @@ - -source source_act -{ - type = mysql - sql_host = 192.168.3.30 - sql_user = sphinx - sql_pass = indexer - sql_db = jo - sql_query_pre = - sql_query = SELECT id, Siren1, RaisonSociale, Siren2, actif, dateLien, IF(dateUpdate > dateInsert, dateUpdate,dateInsert) as dateMaj, source, Pmin*1 AS PminNum, MajMin, PpPm, IF(Pays='','FRA',Pays) AS Pays FROM liens WHERE ActionPart=1 AND Siren1>1000 AND Siren1 IN (SELECT DISTINCT SIREN FROM etablissements_old); - sql_attr_uint = actif - sql_attr_uint = source - sql_attr_uint = PminNum - sql_attr_str2ordinal= MajMin - sql_attr_str2ordinal= PpPm -} - -index act -{ - source = source_act - path = /dbs/sphinx/act - docinfo = extern - morphology = none - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} - -index act_phx -{ - source = source_act - path = /dbs/sphinx/act_phx - docinfo = extern - morphology = libstemmer_francais - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} \ No newline at end of file diff --git a/1.0/config/SphinxHisto/cmp.conf-MysqlServer b/1.0/config/SphinxHisto/cmp.conf-MysqlServer deleted file mode 100644 index d01a87e..0000000 --- a/1.0/config/SphinxHisto/cmp.conf-MysqlServer +++ /dev/null @@ -1,40 +0,0 @@ - -source comptage -{ - type = mysql - sql_host = 192.168.3.30 - sql_user = root - sql_pass = scores - sql_db = jo - sql_port = 3306 - sql_query = SELECT id,ape_etab,ape_entrep,source,siren,nic,actif,siege,adr_cp,adr_dep,adr_com,(tel>100000000) AS tel,(fax>100000000) AS fax,cj,capital,age_entrep,age_etab,tca,tcaexp,teff_entrep,teff_etab,rang,dateCrea_etab,eff_entrep,eff_etab,nbEtab,bilType,bilAnnee,bilTca,bilCA,bilCAexp,bilRN FROM etablissements_act; - sql_attr_str2ordinal = bilType - sql_attr_uint = source - sql_attr_uint = actif - sql_attr_uint = siege - sql_attr_uint = adr_cp - sql_attr_uint = adr_dep - sql_attr_uint = adr_com - sql_attr_uint = tel - sql_attr_uint = fax - sql_attr_uint = cj - sql_attr_uint = capital - sql_attr_uint = age_entrep - sql_attr_uint = age_etab - sql_attr_uint = tca - sql_attr_uint = tcaexp - sql_attr_uint = teff_entrep - sql_attr_uint = teff_etab - sql_attr_uint = rang - sql_attr_uint = dateCrea_etab - sql_attr_uint = eff_entrep - sql_attr_uint = eff_etab - sql_attr_uint = nbEtab - sql_attr_uint = bilAnnee - sql_attr_uint = bilTca - sql_attr_uint = bilCA - sql_attr_uint = bilCAexp - sql_attr_uint = bilRN - - sql_query_info = SELECT siren, nic, ape_etab,ape_entrep, raisonSociale, enseigne, sigle, adr_libVoie, adr_cp, adr_ville FROM etablissements WHERE id=$id; -} \ No newline at end of file diff --git a/1.0/config/SphinxHisto/cmp.conf-MysqlServerSlave b/1.0/config/SphinxHisto/cmp.conf-MysqlServerSlave deleted file mode 100644 index d01a87e..0000000 --- a/1.0/config/SphinxHisto/cmp.conf-MysqlServerSlave +++ /dev/null @@ -1,40 +0,0 @@ - -source comptage -{ - type = mysql - sql_host = 192.168.3.30 - sql_user = root - sql_pass = scores - sql_db = jo - sql_port = 3306 - sql_query = SELECT id,ape_etab,ape_entrep,source,siren,nic,actif,siege,adr_cp,adr_dep,adr_com,(tel>100000000) AS tel,(fax>100000000) AS fax,cj,capital,age_entrep,age_etab,tca,tcaexp,teff_entrep,teff_etab,rang,dateCrea_etab,eff_entrep,eff_etab,nbEtab,bilType,bilAnnee,bilTca,bilCA,bilCAexp,bilRN FROM etablissements_act; - sql_attr_str2ordinal = bilType - sql_attr_uint = source - sql_attr_uint = actif - sql_attr_uint = siege - sql_attr_uint = adr_cp - sql_attr_uint = adr_dep - sql_attr_uint = adr_com - sql_attr_uint = tel - sql_attr_uint = fax - sql_attr_uint = cj - sql_attr_uint = capital - sql_attr_uint = age_entrep - sql_attr_uint = age_etab - sql_attr_uint = tca - sql_attr_uint = tcaexp - sql_attr_uint = teff_entrep - sql_attr_uint = teff_etab - sql_attr_uint = rang - sql_attr_uint = dateCrea_etab - sql_attr_uint = eff_entrep - sql_attr_uint = eff_etab - sql_attr_uint = nbEtab - sql_attr_uint = bilAnnee - sql_attr_uint = bilTca - sql_attr_uint = bilCA - sql_attr_uint = bilCAexp - sql_attr_uint = bilRN - - sql_query_info = SELECT siren, nic, ape_etab,ape_entrep, raisonSociale, enseigne, sigle, adr_libVoie, adr_cp, adr_ville FROM etablissements WHERE id=$id; -} \ No newline at end of file diff --git a/1.0/config/SphinxHisto/dir.conf-MysqlServer b/1.0/config/SphinxHisto/dir.conf-MysqlServer deleted file mode 100644 index 10ea1f0..0000000 --- a/1.0/config/SphinxHisto/dir.conf-MysqlServer +++ /dev/null @@ -1,59 +0,0 @@ - -source source_dir -{ - type = mysql - sql_host = 192.168.3.30 - sql_user = sphinx - sql_pass = indexer - sql_db = jo - sql_query_pre = -# sql_query = SELECT id, siren, actif, \ -#IF(civilite='M',1,IF(civilite='MME' OR civilite='MLLE',2,0)) AS genre, \ -#CONCAT(nom,' ',naissance_nom, ' ', dirRS) AS nom, prenom, \ -# YEAR(naissance_date) AS naiss_annee, \ -#MONTH(naissance_date) AS naiss_mois, \ -# DAY(naissance_date) AS naiss_jour, \ -#naissance_lieu, adr_dep \ -#FROM rncs_dirigeants; - sql_query = SELECT id, siren, adr_dep, typeDir, dirSiren, civilite, CONCAT(nom,' ',naissance_nom, ' ', dirRS) AS nom, prenom, \ - YEAR(naissance_date) AS naiss_annee, \ - MONTH(naissance_date) AS naiss_mois, \ - DAY(naissance_date) AS naiss_jour, \ - naissance_lieu, fonction_code, actif \ - FROM dirigeants_tmp; - sql_attr_str2ordinal= civilite - sql_attr_str2ordinal= typeDir - sql_attr_str2ordinal= fonction_code - sql_attr_uint = dirSiren - sql_attr_uint = naiss_annee - sql_attr_uint = naiss_mois - sql_attr_uint = naiss_jour - sql_attr_uint = actif -# sql_attr_uint = genre - sql_attr_uint = adr_dep -} - -index dir -{ - source = source_dir - path = /dbs/sphinx/dir - docinfo = extern - morphology = none - #ispell_aff = /usr/local/sphinx/etc/francais.aff - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} - -index dir_phx -{ - source = source_dir - path = /dbs/sphinx/dir_phx - docinfo = extern - morphology = libstemmer_francais - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} \ No newline at end of file diff --git a/1.0/config/SphinxHisto/dir.conf-MysqlServerSlave b/1.0/config/SphinxHisto/dir.conf-MysqlServerSlave deleted file mode 100644 index 10ea1f0..0000000 --- a/1.0/config/SphinxHisto/dir.conf-MysqlServerSlave +++ /dev/null @@ -1,59 +0,0 @@ - -source source_dir -{ - type = mysql - sql_host = 192.168.3.30 - sql_user = sphinx - sql_pass = indexer - sql_db = jo - sql_query_pre = -# sql_query = SELECT id, siren, actif, \ -#IF(civilite='M',1,IF(civilite='MME' OR civilite='MLLE',2,0)) AS genre, \ -#CONCAT(nom,' ',naissance_nom, ' ', dirRS) AS nom, prenom, \ -# YEAR(naissance_date) AS naiss_annee, \ -#MONTH(naissance_date) AS naiss_mois, \ -# DAY(naissance_date) AS naiss_jour, \ -#naissance_lieu, adr_dep \ -#FROM rncs_dirigeants; - sql_query = SELECT id, siren, adr_dep, typeDir, dirSiren, civilite, CONCAT(nom,' ',naissance_nom, ' ', dirRS) AS nom, prenom, \ - YEAR(naissance_date) AS naiss_annee, \ - MONTH(naissance_date) AS naiss_mois, \ - DAY(naissance_date) AS naiss_jour, \ - naissance_lieu, fonction_code, actif \ - FROM dirigeants_tmp; - sql_attr_str2ordinal= civilite - sql_attr_str2ordinal= typeDir - sql_attr_str2ordinal= fonction_code - sql_attr_uint = dirSiren - sql_attr_uint = naiss_annee - sql_attr_uint = naiss_mois - sql_attr_uint = naiss_jour - sql_attr_uint = actif -# sql_attr_uint = genre - sql_attr_uint = adr_dep -} - -index dir -{ - source = source_dir - path = /dbs/sphinx/dir - docinfo = extern - morphology = none - #ispell_aff = /usr/local/sphinx/etc/francais.aff - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} - -index dir_phx -{ - source = source_dir - path = /dbs/sphinx/dir_phx - docinfo = extern - morphology = libstemmer_francais - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} \ No newline at end of file diff --git a/1.0/config/SphinxHisto/ent.conf-MysqlServer b/1.0/config/SphinxHisto/ent.conf-MysqlServer deleted file mode 100644 index 9f46f0c..0000000 --- a/1.0/config/SphinxHisto/ent.conf-MysqlServer +++ /dev/null @@ -1,72 +0,0 @@ - -source source_ent -{ - type = mysql - sql_host = 192.168.3.30 - sql_user = sphinx - sql_pass = indexer - sql_db = jo - sql_query_pre = - sql_query = SELECT id, siren, nic, siege, CONCAT(raisonSociale,\ -' "" ',enseigne,' "" ',sigle,' "" ',identite_pre,' "" ',\ -REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(sigle,' ',''),\ -'@','A'), '&',' ET '),'/',''),',',''),'-',''),'.',''),' ',\ -REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(sigle,\ -'@','A'), '&',' ET '),'/',''),',',''),'-',''),'.','')) AS nom, adr_dep, \ -actif, adr_num, adr_typeVoie, CONCAT(adr_libVoie,' ',adr_comp) AS adresse, adr_cp, \ -adr_ville AS ville, cj, ape_etab, (siren>200) AS sirenValide, rang \ -FROM etablissements_tmp; - sql_attr_str2ordinal = adr_typeVoie - sql_attr_uint = siren - sql_attr_uint = nic - sql_attr_uint = siege - sql_attr_uint = adr_num - sql_attr_uint = adr_cp - sql_attr_uint = adr_dep - sql_attr_uint = actif - sql_attr_uint = cj - sql_attr_uint = sirenValide - sql_attr_uint = rang - -} - -index ent -{ - source = source_ent - path = /dbs/sphinx/ent - docinfo = extern - wordforms = /usr/local/sphinx/etc/wordforms.txt - abreviations = /usr/local/sphinx/etc/abreviations.txt - ispell_aff = /usr/local/sphinx/etc/francais.aff - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} - -index ent_mns -{ - source = source_ent - path = /dbs/sphinx/ent_mns - docinfo = extern - wordforms = /usr/local/sphinx/etc/wordforms.txt - abreviations = /usr/local/sphinx/etc/abreviations.txt - non_significatifs = /usr/local/sphinx/etc/mots-non-significatifs.txt - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} - -index ent_phx -{ - source = source_ent - path = /dbs/sphinx/ent_phx - docinfo = extern - morphology = libstemmer_francais - wordforms = /usr/local/sphinx/etc/wordforms.txt - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} \ No newline at end of file diff --git a/1.0/config/SphinxHisto/ent.conf-MysqlServerSlave b/1.0/config/SphinxHisto/ent.conf-MysqlServerSlave deleted file mode 100644 index 9f46f0c..0000000 --- a/1.0/config/SphinxHisto/ent.conf-MysqlServerSlave +++ /dev/null @@ -1,72 +0,0 @@ - -source source_ent -{ - type = mysql - sql_host = 192.168.3.30 - sql_user = sphinx - sql_pass = indexer - sql_db = jo - sql_query_pre = - sql_query = SELECT id, siren, nic, siege, CONCAT(raisonSociale,\ -' "" ',enseigne,' "" ',sigle,' "" ',identite_pre,' "" ',\ -REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(sigle,' ',''),\ -'@','A'), '&',' ET '),'/',''),',',''),'-',''),'.',''),' ',\ -REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(sigle,\ -'@','A'), '&',' ET '),'/',''),',',''),'-',''),'.','')) AS nom, adr_dep, \ -actif, adr_num, adr_typeVoie, CONCAT(adr_libVoie,' ',adr_comp) AS adresse, adr_cp, \ -adr_ville AS ville, cj, ape_etab, (siren>200) AS sirenValide, rang \ -FROM etablissements_tmp; - sql_attr_str2ordinal = adr_typeVoie - sql_attr_uint = siren - sql_attr_uint = nic - sql_attr_uint = siege - sql_attr_uint = adr_num - sql_attr_uint = adr_cp - sql_attr_uint = adr_dep - sql_attr_uint = actif - sql_attr_uint = cj - sql_attr_uint = sirenValide - sql_attr_uint = rang - -} - -index ent -{ - source = source_ent - path = /dbs/sphinx/ent - docinfo = extern - wordforms = /usr/local/sphinx/etc/wordforms.txt - abreviations = /usr/local/sphinx/etc/abreviations.txt - ispell_aff = /usr/local/sphinx/etc/francais.aff - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} - -index ent_mns -{ - source = source_ent - path = /dbs/sphinx/ent_mns - docinfo = extern - wordforms = /usr/local/sphinx/etc/wordforms.txt - abreviations = /usr/local/sphinx/etc/abreviations.txt - non_significatifs = /usr/local/sphinx/etc/mots-non-significatifs.txt - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} - -index ent_phx -{ - source = source_ent - path = /dbs/sphinx/ent_phx - docinfo = extern - morphology = libstemmer_francais - wordforms = /usr/local/sphinx/etc/wordforms.txt - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} \ No newline at end of file diff --git a/1.0/config/SphinxHisto/histo.conf-MysqlServer b/1.0/config/SphinxHisto/histo.conf-MysqlServer deleted file mode 100644 index 29473ad..0000000 --- a/1.0/config/SphinxHisto/histo.conf-MysqlServer +++ /dev/null @@ -1,39 +0,0 @@ -# -# Sphinx configuration file sample -# -# WARNING! While this sample file mentions all available options, -# it contains (very) short helper descriptions only. Please refer to -# doc/sphinx.html for details. -# - -############################################################################# -## data source definition -############################################################################# - -source histo -{ - type = mysql - sql_host = 192.168.78.230 - sql_user = sphinx_histo - sql_pass = sphinx - sql_db = histobodacc - sql_port = 3306 # optional, default is 3306 - sql_query = SELECT id, nomFichier, annee1, dateBod, texte FROM bodacc_ocr; - sql_attr_uint = annee1 - sql_query_info = SELECT * FROM bodacc_ocr WHERE id=$id -} - -############################################################################# -## index definition -############################################################################# - -index histo -{ - source = histo - path = /home/sphinx/histo - docinfo = extern - morphology = none - min_word_len = 1 - charset_type = sbcs - html_strip = 1 -} diff --git a/1.0/config/SphinxHisto/sphinx.conf b/1.0/config/SphinxHisto/sphinx.conf index b390725..36fd0cf 100644 --- a/1.0/config/SphinxHisto/sphinx.conf +++ b/1.0/config/SphinxHisto/sphinx.conf @@ -7,7 +7,7 @@ indexer { # memory limit, in bytes, kiloytes (16384K) or megabytes (256M) # optional, default is 32M, max is 2047M, recommended is 256M to 1024M - mem_limit = 256 + mem_limit = 2047M # maximum IO calls per second (for I/O throttling) # optional, default is 0 (unlimited) @@ -65,7 +65,7 @@ searchd # seamless rotate, prevents rotate stalls if precaching huge datasets # optional, default is 1 - seamless_rotate = 0 + seamless_rotate = 1 # whether to forcibly preopen all indexes on startup # optional, default is 0 (do not preopen) diff --git a/1.0/config/sdsrvws02/act.conf-MysqlServer b/1.0/config/sdsrvws02/act.conf-MysqlServer deleted file mode 100644 index 9682316..0000000 --- a/1.0/config/sdsrvws02/act.conf-MysqlServer +++ /dev/null @@ -1,31 +0,0 @@ -source source_act -{ - type = mysql - sql_host = 192.168.3.30 - sql_user = sphinx - sql_pass = indexer - sql_db = jo - sql_query_pre = - sql_query = SELECT id, Siren1, RaisonSociale, Siren2, actif, dateLien, IF(dateUpdate>dateInsert,dateUpdate,dateInsert) as dateMaj, \ - source, Pmin*1 AS PminNum, MajMin, PpPm, IF(Pays='','FRA',Pays) AS Pays \ - FROM liens \ - WHERE ActionPart=1 AND Siren1>1000 AND Siren1 IN (SELECT DISTINCT SIREN FROM etablissements_old); - sql_attr_uint = actif - sql_attr_uint = source - sql_attr_uint = PminNum - sql_attr_str2ordinal= MajMin - sql_attr_str2ordinal= PpPm - sql_attr_str2ordinal= Pays -} - -index act -{ - source = source_act - path = /dbs/sphinx/act - docinfo = extern - morphology = none - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} \ No newline at end of file diff --git a/1.0/config/sdsrvws02/act.conf-MysqlServerSlave b/1.0/config/sdsrvws02/act.conf-MysqlServerSlave deleted file mode 100644 index 9682316..0000000 --- a/1.0/config/sdsrvws02/act.conf-MysqlServerSlave +++ /dev/null @@ -1,31 +0,0 @@ -source source_act -{ - type = mysql - sql_host = 192.168.3.30 - sql_user = sphinx - sql_pass = indexer - sql_db = jo - sql_query_pre = - sql_query = SELECT id, Siren1, RaisonSociale, Siren2, actif, dateLien, IF(dateUpdate>dateInsert,dateUpdate,dateInsert) as dateMaj, \ - source, Pmin*1 AS PminNum, MajMin, PpPm, IF(Pays='','FRA',Pays) AS Pays \ - FROM liens \ - WHERE ActionPart=1 AND Siren1>1000 AND Siren1 IN (SELECT DISTINCT SIREN FROM etablissements_old); - sql_attr_uint = actif - sql_attr_uint = source - sql_attr_uint = PminNum - sql_attr_str2ordinal= MajMin - sql_attr_str2ordinal= PpPm - sql_attr_str2ordinal= Pays -} - -index act -{ - source = source_act - path = /dbs/sphinx/act - docinfo = extern - morphology = none - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} \ No newline at end of file diff --git a/1.0/config/sdsrvws02/cmp.conf-MysqlServer b/1.0/config/sdsrvws02/cmp.conf-MysqlServer deleted file mode 100644 index d01a87e..0000000 --- a/1.0/config/sdsrvws02/cmp.conf-MysqlServer +++ /dev/null @@ -1,40 +0,0 @@ - -source comptage -{ - type = mysql - sql_host = 192.168.3.30 - sql_user = root - sql_pass = scores - sql_db = jo - sql_port = 3306 - sql_query = SELECT id,ape_etab,ape_entrep,source,siren,nic,actif,siege,adr_cp,adr_dep,adr_com,(tel>100000000) AS tel,(fax>100000000) AS fax,cj,capital,age_entrep,age_etab,tca,tcaexp,teff_entrep,teff_etab,rang,dateCrea_etab,eff_entrep,eff_etab,nbEtab,bilType,bilAnnee,bilTca,bilCA,bilCAexp,bilRN FROM etablissements_act; - sql_attr_str2ordinal = bilType - sql_attr_uint = source - sql_attr_uint = actif - sql_attr_uint = siege - sql_attr_uint = adr_cp - sql_attr_uint = adr_dep - sql_attr_uint = adr_com - sql_attr_uint = tel - sql_attr_uint = fax - sql_attr_uint = cj - sql_attr_uint = capital - sql_attr_uint = age_entrep - sql_attr_uint = age_etab - sql_attr_uint = tca - sql_attr_uint = tcaexp - sql_attr_uint = teff_entrep - sql_attr_uint = teff_etab - sql_attr_uint = rang - sql_attr_uint = dateCrea_etab - sql_attr_uint = eff_entrep - sql_attr_uint = eff_etab - sql_attr_uint = nbEtab - sql_attr_uint = bilAnnee - sql_attr_uint = bilTca - sql_attr_uint = bilCA - sql_attr_uint = bilCAexp - sql_attr_uint = bilRN - - sql_query_info = SELECT siren, nic, ape_etab,ape_entrep, raisonSociale, enseigne, sigle, adr_libVoie, adr_cp, adr_ville FROM etablissements WHERE id=$id; -} \ No newline at end of file diff --git a/1.0/config/sdsrvws02/cmp.conf-MysqlServerSlave b/1.0/config/sdsrvws02/cmp.conf-MysqlServerSlave deleted file mode 100644 index d01a87e..0000000 --- a/1.0/config/sdsrvws02/cmp.conf-MysqlServerSlave +++ /dev/null @@ -1,40 +0,0 @@ - -source comptage -{ - type = mysql - sql_host = 192.168.3.30 - sql_user = root - sql_pass = scores - sql_db = jo - sql_port = 3306 - sql_query = SELECT id,ape_etab,ape_entrep,source,siren,nic,actif,siege,adr_cp,adr_dep,adr_com,(tel>100000000) AS tel,(fax>100000000) AS fax,cj,capital,age_entrep,age_etab,tca,tcaexp,teff_entrep,teff_etab,rang,dateCrea_etab,eff_entrep,eff_etab,nbEtab,bilType,bilAnnee,bilTca,bilCA,bilCAexp,bilRN FROM etablissements_act; - sql_attr_str2ordinal = bilType - sql_attr_uint = source - sql_attr_uint = actif - sql_attr_uint = siege - sql_attr_uint = adr_cp - sql_attr_uint = adr_dep - sql_attr_uint = adr_com - sql_attr_uint = tel - sql_attr_uint = fax - sql_attr_uint = cj - sql_attr_uint = capital - sql_attr_uint = age_entrep - sql_attr_uint = age_etab - sql_attr_uint = tca - sql_attr_uint = tcaexp - sql_attr_uint = teff_entrep - sql_attr_uint = teff_etab - sql_attr_uint = rang - sql_attr_uint = dateCrea_etab - sql_attr_uint = eff_entrep - sql_attr_uint = eff_etab - sql_attr_uint = nbEtab - sql_attr_uint = bilAnnee - sql_attr_uint = bilTca - sql_attr_uint = bilCA - sql_attr_uint = bilCAexp - sql_attr_uint = bilRN - - sql_query_info = SELECT siren, nic, ape_etab,ape_entrep, raisonSociale, enseigne, sigle, adr_libVoie, adr_cp, adr_ville FROM etablissements WHERE id=$id; -} \ No newline at end of file diff --git a/1.0/config/sdsrvws02/dir.conf-MysqlServerSlave b/1.0/config/sdsrvws02/dir.conf-MysqlServerSlave deleted file mode 100644 index be3e753..0000000 --- a/1.0/config/sdsrvws02/dir.conf-MysqlServerSlave +++ /dev/null @@ -1,45 +0,0 @@ -source source_dir -{ - type = mysql - sql_host = 192.168.3.30 - sql_user = sphinx - sql_pass = indexer - sql_db = jo - sql_query_pre = - sql_query = SELECT id, siren, actif, \ -IF(civilite='M',1,IF(civilite='MME' OR civilite='MLLE',2,0)) AS genre, \ -CONCAT(nom,' ',naissance_nom, ' ', dirRS) AS nom, prenom, \ - YEAR(naissance_date) AS naiss_annee, \ -MONTH(naissance_date) AS naiss_mois, \ - DAY(naissance_date) AS naiss_jour, \ -naissance_lieu, adr_dep \ -FROM rncs_dirigeants; -# UNION \ -#SELECT id, siren, 0 AS actif, \ -#'' AS genre, \ -#CONCAT(nom,' ',nomUsage,' ',rs) AS nom, prenom, \ -#0 AS naiss_annee, \ -#0 AS naiss_mois, \ -#0 AS naiss_jour, \ -#'' AS naissance_lieu, 0 AS adr_dep \ -#FROM bodacc_dirigeants_histo; - sql_attr_uint = naiss_annee - sql_attr_uint = naiss_mois - sql_attr_uint = naiss_jour - sql_attr_uint = actif - sql_attr_uint = genre - sql_attr_uint = adr_dep -} - -index dir -{ - source = source_dir - path = /dbs/sphinx/dir - docinfo = extern - morphology = none - #ispell_aff = /usr/local/sphinx/etc/francais.aff - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} \ No newline at end of file diff --git a/1.0/config/sdsrvws02/ent.conf-MysqlServerSlave b/1.0/config/sdsrvws02/ent.conf-MysqlServerSlave deleted file mode 100644 index 84d34ac..0000000 --- a/1.0/config/sdsrvws02/ent.conf-MysqlServerSlave +++ /dev/null @@ -1,44 +0,0 @@ -source source_ent -{ - type = mysql - sql_host = 192.168.3.30 - sql_user = sphinx - sql_pass = indexer - sql_db = jo - sql_query_pre = - sql_query = SELECT id, siren, nic, siege, CONCAT(raisonSociale,\ -' "" ',enseigne,' "" ',sigle,' "" ',identite_pre,' "" ',\ -REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(sigle,' ',''),\ -'@','A'), '&',' ET '),'/',''),',',''),'-',''),'.',''),' ',\ -REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(sigle,\ -'@','A'), '&',' ET '),'/',''),',',''),'-',''),'.','')) AS nom, adr_dep, \ -actif, adr_num, adr_typeVoie, CONCAT(adr_libVoie,' ',adr_comp) AS adresse, adr_cp, \ -adr_ville AS ville, cj, ape_etab, (siren>200) AS sirenValide, rang \ -FROM etablissements; - sql_attr_str2ordinal = adr_typeVoie - sql_attr_uint = siren - sql_attr_uint = nic - sql_attr_uint = siege - sql_attr_uint = adr_num - sql_attr_uint = adr_cp - sql_attr_uint = adr_dep - sql_attr_uint = actif - sql_attr_uint = cj - sql_attr_uint = sirenValide - sql_attr_uint = rang - -} - -index ent -{ - source = source_ent - path = /dbs/sphinx/ent - docinfo = extern - wordforms = /usr/local/sphinx/etc/wordforms.txt - abreviations = /usr/local/sphinx/etc/abreviations.txt - ispell_aff = /usr/local/sphinx/etc/francais.aff - charset_type = sbcs - charset_table = 0..9, A..Z->a..z, a..z, \ -U+23, U+25, U+26, U+2B, U+3D, U+40, \ -U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF -} \ No newline at end of file diff --git a/1.0/config/sdsrvws02/sphinx.conf b/1.0/config/srvws02/sphinx.conf similarity index 96% rename from 1.0/config/sdsrvws02/sphinx.conf rename to 1.0/config/srvws02/sphinx.conf index b390725..b518273 100644 --- a/1.0/config/sdsrvws02/sphinx.conf +++ b/1.0/config/srvws02/sphinx.conf @@ -7,12 +7,12 @@ indexer { # memory limit, in bytes, kiloytes (16384K) or megabytes (256M) # optional, default is 32M, max is 2047M, recommended is 256M to 1024M - mem_limit = 256 + mem_limit = 1024M # maximum IO calls per second (for I/O throttling) # optional, default is 0 (unlimited) # - # max_iops = 40 + max_iops = 40 # maximum IO call size, bytes (for I/O throttling) @@ -36,7 +36,7 @@ searchd # searchd TCP port number # mandatory, default is 3312 - listen = 3312 + listen = 9312 # log file, searchd run info is logged here # optional, default is 'searchd.log' @@ -65,7 +65,7 @@ searchd # seamless rotate, prevents rotate stalls if precaching huge datasets # optional, default is 1 - seamless_rotate = 0 + seamless_rotate = 1 # whether to forcibly preopen all indexes on startup # optional, default is 0 (do not preopen) diff --git a/1.0/config/srvws02/srvws02/dir.conf b/1.0/config/srvws02/srvws02/dir.conf new file mode 100644 index 0000000..51eca0c --- /dev/null +++ b/1.0/config/srvws02/srvws02/dir.conf @@ -0,0 +1,36 @@ +source source_dir +{ + type = mysql + sql_host = 192.168.3.24 + sql_user = sphinx + sql_pass = indexer + sql_db = jo + sql_query_pre = + sql_query = SELECT id, siren, actif, \ + IF(civilite='M',1,IF(civilite='MME' OR civilite='MLLE',2,0)) AS genre, \ + CONCAT(nom,' ',naissance_nom, ' ', dirRS) AS nom, prenom, \ + YEAR(naissance_date) AS naiss_annee, \ + MONTH(naissance_date) AS naiss_mois, \ + DAY(naissance_date) AS naiss_jour, \ + naissance_lieu, adr_dep \ + FROM rncs_dirigeants; + sql_attr_uint = naiss_annee + sql_attr_uint = naiss_mois + sql_attr_uint = naiss_jour + sql_attr_uint = actif + sql_attr_uint = genre + sql_attr_uint = adr_dep +} + +index dir +{ + source = source_dir + path = /dbs/sphinx/dir + docinfo = extern + morphology = none + #ispell_aff = /usr/local/sphinx/etc/francais.aff + charset_type = sbcs + charset_table = 0..9, A..Z->a..z, a..z, \ + U+23, U+25, U+26, U+2B, U+3D, U+40, \ + U+C0..U+DE->U+E0..U+FE, U+DF, U+E0..U+FF +} diff --git a/1.0/configure.php b/1.0/configure.php new file mode 100644 index 0000000..db2e230 --- /dev/null +++ b/1.0/configure.php @@ -0,0 +1,92 @@ +hostname = exec('echo $(hostname)'); + $this->sphinx = 'sphinx.conf'; + $this->dirname = 'config/'.$this->hostname.'/'; + (file_exists($this->sphinx))?unlink($this->sphinx):''; + } + + + public function printIndexes($nbServer) + { + $dir = opendir($this->dirname.$this->sql[$nbServer].'/'); + $i = 1; + + while($file = readdir($dir)) { + if($file != '.' and $file != '..') { + echo "\t\t".'['.$i.'] '. $file."\n"; + $this->indexes[$i] = $file;$i++; + } + } + if(count($this->indexes) == 0) { + echo "\tAucun indexes dans le repertoire : '".$this->dirname.$this->sql[$nbServer]."' \n"; + exit; + } + } + + public function printMysqlServer() + { + $dir = opendir($this->dirname); + $i = 1; + + while($rep = readdir($dir)) { + if($rep != '.' and $rep != '..' and is_dir($this->dirname.$rep)) { + echo "\t".'['.$i.'] '.$rep."\n"; + $this->sql[$i] = $rep; + $this->printIndexes($i); + $i++; + } + } + if(count($this->sql) == 0) { + echo "\tAucun serveurs dans le repertoire : '".$this->dirname."' \n"; + exit; + } + } + + public function createConfig($mySqlServer, $index) + { + $dirname = $this->dirname.$mySqlServer.'/'; + $dir = opendir($dirname); + + if(file_exists($dirname.$index)) { + file_put_contents($this->sphinx, file_get_contents($dirname.$index), FILE_APPEND); + return (true); + } + return (false); + } + + public function inviteDeCommande() + { + $handle = fopen('.', 'r'); + $server = ''; + + fwrite(STDOUT, "\n - Serveurs SQL disponnible :\n"); + $this->printMysqlServer(); + while($server != "exit\n") { + echo "Selectionnez Server et Indexe : "; + $server = fgets(STDIN); + $indexes = explode(' ', $server); + if(isset($this->sql[intval($indexes[0])]) and isset($this->indexes[intval($indexes[1])])) { + $this->createConfig($this->sql[intval($indexes[0])], $this->indexes[intval($indexes[1])]); + echo 'Indexe ajouté !'."\n"; + } else + echo 'Cet indexe n\'existe pas !'."\n"; + } + file_put_contents($this->sphinx, file_get_contents($this->dirname.$this->sphinx), FILE_APPEND); + exec('sudo mv '.$this->sphinx.' /usr/local/sphinx/etc/'.$this->sphinx); + } + +} + +$a = new configure(); +$a->inviteDeCommande(); diff --git a/1.0/indexer/sh/indexerOld.sh b/1.0/indexer/sh/indexerOld.sh deleted file mode 100755 index 0bf8be5..0000000 --- a/1.0/indexer/sh/indexerOld.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -PATH_BIN=/usr/local/sphinx/bin -PATH_LOG=/dbs/sphinxlog - -DATE=`date '+%Y-%m-%d %H-%M-%S'` - -echo "DEBUT de l'indexation ==== $(date +%H:%M:%S)" >> $PATH_LOG/indexerEtab-$(date +%F).log - -# nombre de lignes dans la table etab -output=$(mysql -h192.168.3.30 -usphinx -pindexer jo < sql/countEtab.sql) -for line in "$output"; do - etab="$line" -done -# Suppression fin de ligne -etab=$(echo $etab|sed -e "s/^[etab ]*//g"||sed -e "s/[ ]*$//g") -# Cast de la variable au cas ou -#etab=$(echo $etab| gawk '{print + 0}') - -# nombre de lignes dans la table etab_tmp -output=$(mysql -h192.168.3.30 -usphinx -pindexer jo < sql/countEtab_tmp.sql) -for line in "$output"; do - etab_tmp="$line" -done -# Suppression fin de ligne -etab_tmp=$(echo $etab_tmp|sed -e "s/^[etab_tmp ]*//g"||sed -e "s/[ ]*$//g") -# Cast de la variable au cas ou -#etab_tmp=$(echo $etab_tmp| gawk '{print + 0}') - -# Comparaison du nombre de lignes entre etab (ancien) et etab_tmp (nouveau) -if test $etab_tmp -gt $etab; then - echo "Il y a $etab_tmp lignes dans la nouvelle table etablissement ($etab lignes dans l'ancienne)" >> $PATH_LOG/indexerEtab-$(date +%F).log -# $PATH_BIN/indexer --rotate --all >> $PATH_LOG/indexer-$(date +%F).log - $PATH_BIN/indexer --rotate ent ent_mns ent_phx >> $PATH_LOG/indexerEtab-$(date +%F).log - echo "Sphinx - terminé : $(date +%H:%M:%S)" >> $PATH_LOG/indexerEtab-$(date +%F).log - mysql -f -uroot -h192.168.3.30 -pscores jo < finIndexationEtab.sql >> $PATH_LOG/indexerEtab-$(date +%F).log -else - # Il y a plus de lignes dans l'ancienne table etablissements ==> On ne fait rien - echo "Il n'y a pas assez de lignes dans la nouvelle table etablissement ($etab_tmp / $etab) !" >> $PATH_LOG/indexerEtab-$(date +%F).log - exit -fi - -echo "FIN ===== $(date +%H:%M:%S)" >> $PATH_LOG/indexerEtab-$(date +%F).log