Merge depuis trunk

This commit is contained in:
Michael RICOIS 2011-10-28 08:34:13 +00:00
commit 87d635651c
42 changed files with 1831 additions and 0 deletions

131
Sphinx.sh Executable file
View File

@ -0,0 +1,131 @@
#!/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")
function loadIndication() {
while [ -d "/proc/$1" ]
do #Current PID in /proc |
echo -en "Loading... /\033[1G"; sleep .07
echo -en "Loading... -\033[1G"; sleep .07
echo -en "Loading... / \033[1G"; sleep .07
echo -en "Loading... |\033[1G"; sleep .07
done
}
if [ `id -u` = 0 ] #Need Root or Sudo
then
commande=('--configure' '--install' '--all')
for i; do
case $i in
'--help')
`man SphinxHelp` #en cours de création du man !
;;
'--delete')
`rm -r indexeConf tmp sphinx-* wget* libste* *~ 2> /dev/null`
echo -e "- Clean directory"
exit
;;
'--version')
echo -e "1. Last version : 2.0.1"
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 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 sphinx-2.0.1.tar.gz ] || [ ! -e sphinx-0.9.9.tar.gz ]
then
if [ ! -z $2 ]; then
if [ $2 == "2.0.1" ]; then
version="$2-beta"
elif [ $2 == "0.9.9" ]; then
version="$2"
else
echo -e $ROUGE"[Erreur]: This version not exist !"$NORMAL
exit
fi
echo -e $CYAN"Download Sphinx-$version..."$NORMAL
`wget -b http://sphinxsearch.com/files/sphinx-$version.tar.gz >/dev/null`
loadIndication `(ps -C wget -o pid=)`
`rm wget-log*`
else
echo -e $ROUGE"[Erreur]: Please specifie version, exemple 2.0.1 or 0.9.9"$NORMAL
exit
fi
fi
`tar -z -xf sphinx-$version.tar.gz -C tmp `
`rm sphinx-$version.tar.gz*`
echo -e " - Extract files..."
echo -e " - Complited"
#If libstemmer not installed in tmp/
if [ -e libstemmer_c.tgz ]
then
echo -e $CYAN"Extract file from libstemmer_c..."$NORMAL
`mv libstemmer_c.tgz tmp/sphinx-$version/libstemmer_c; cd tmp/sphinx-$version/libstemmer_c/ ; tar -zxf libstemmer_c.tgz`
echo -e " - Complited"
else
echo -e $CYAN"Download and Configure libstemmer..."$NORMAL
`cd tmp/sphinx-$version ; wget -b http://snowball.tartarus.org/dist/libstemmer_c.tgz > /dev/null`
loadIndication `(ps -C wget -o pid=)`
`cd tmp/sphinx-$version ; tar -zxf libstemmer_c.tgz`
echo -e "- Complited"
fi
echo -e "- Extract files..."
libstemmer="100%"
echo ""
echo -e $CYAN"Configuration progress..."$ROUGE
`cd tmp/sphinx-$version ; sh configure --with-libstemmer --prefix=/usr/local/sphinx 1> /dev/null `
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
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
;;
*)
#Default
echo -e $ROUGE"[Erreur]" ${ERREURS["CMD"]} $NORMAL
exit
;;
esac
done
echo -e $ROUGE"[Erreur]" ${ERREURS["NOCMD"]} $NORMAL
else
echo -e $ROUGE"[Erreur]" ${ERREURS["CHMOD"]} $NORMAL
fi

View File

@ -0,0 +1,31 @@
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
}

View File

@ -0,0 +1,31 @@
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
}

View File

@ -0,0 +1,40 @@
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;
}

View File

@ -0,0 +1,40 @@
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;
}

View File

@ -0,0 +1,45 @@
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
}

View File

@ -0,0 +1,45 @@
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
}

View File

@ -0,0 +1,44 @@
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
}

View File

@ -0,0 +1,44 @@
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
}

View File

@ -0,0 +1,39 @@
#
# 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
}

77
config/Sphinx/sphinx.conf Normal file
View File

@ -0,0 +1,77 @@
#############################################################################
## 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 = 256
# 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
# searchd TCP port number
# mandatory, default is 3312
listen = 3312
# log file, searchd run info is logged here
# optional, default is 'searchd.log'
log = /dbs/sphinxlog/searchd.log
# query log file, all search queries are logged here
# optional, default is empty (do not log queries)
query_log = /dbs/sphinxlog/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 = 0
# 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
}

View File

@ -0,0 +1,40 @@
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
}

View File

@ -0,0 +1,40 @@
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
}

View File

@ -0,0 +1,40 @@
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;
}

View File

@ -0,0 +1,40 @@
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;
}

View File

@ -0,0 +1,59 @@
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
}

View File

@ -0,0 +1,59 @@
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
}

View File

@ -0,0 +1,72 @@
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
}

View File

@ -0,0 +1,72 @@
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
}

View File

@ -0,0 +1,39 @@
#
# 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
}

View File

@ -0,0 +1,77 @@
#############################################################################
## 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 = 256
# 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
# searchd TCP port number
# mandatory, default is 3312
listen = 3312
# log file, searchd run info is logged here
# optional, default is 'searchd.log'
log = /dbs/sphinxlog/searchd.log
# query log file, all search queries are logged here
# optional, default is empty (do not log queries)
query_log = /dbs/sphinxlog/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 = 0
# 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
}

View File

@ -0,0 +1,31 @@
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
}

View File

@ -0,0 +1,31 @@
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
}

View File

@ -0,0 +1,40 @@
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;
}

View File

@ -0,0 +1,40 @@
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;
}

View File

@ -0,0 +1,45 @@
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
}

View File

@ -0,0 +1,45 @@
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
}

View File

@ -0,0 +1,44 @@
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
}

View File

@ -0,0 +1,44 @@
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
}

View File

@ -0,0 +1,39 @@
#
# 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
}

View File

@ -0,0 +1,77 @@
#############################################################################
## 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 = 256
# 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
# searchd TCP port number
# mandatory, default is 3312
listen = 3312
# log file, searchd run info is logged here
# optional, default is 'searchd.log'
log = /dbs/sphinxlog/searchd.log
# query log file, all search queries are logged here
# optional, default is empty (do not log queries)
query_log = /dbs/sphinxlog/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 = 0
# 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
}

37
indexer/sh/indexerDiri.sh Executable file
View File

@ -0,0 +1,37 @@
#!/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/indexerDiri-$(date +%F).log
# nombre de lignes dans la table etab
output=$(mysql -h192.168.3.30 -usphinx -pindexer jo < sql/countDiri.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")
# nombre de lignes dans la table diri_tmp
output=$(mysql -h192.168.3.30 -usphinx -pindexer jo < sql/countDiri_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")
# 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 dirigeants ($etab lignes dans l'ancienne)" >> $PATH_LOG/indexerDiri-$(date +%F).log
$PATH_BIN/indexer --rotate dir dir_phx >> $PATH_LOG/indexerDiri-$(date +%F).log
echo "Sphinx - termine : $(date +%H:%M:%S)" >> $PATH_LOG/indexerDiri-$(date +%F).log
mysql -f -uroot -h192.168.3.30 -pscores jo < finIndexationDiri.sql >> $PATH_LOG/indexerDiri-$(date +%F).log
else
# Il y a plus de lignes dans l'ancienne table dirigeants ==> On ne fait rien
echo "Il n'y a pas assez de lignes dans la nouvelle table dirigeants ($etab_tmp / $etab) !" >> $PATH_LOG/indexerDiri-$(date +%F).log
exit
fi
echo "FIN ===== $(date +%H:%M:%S)" >> $PATH_LOG/indexerDiri-$(date +%F).log

42
indexer/sh/indexerEtab.sh Executable file
View File

@ -0,0 +1,42 @@
#!/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

42
indexer/sh/indexerOld.sh Executable file
View File

@ -0,0 +1,42 @@
#!/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

BIN
indexer/sql/countDiri.sql Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
SELECT count(*) AS etab_tmp from dirigeants_tmp;

View File

@ -0,0 +1 @@
SELECT count(*) AS etab from etablissements;

View File

@ -0,0 +1 @@
SELECT count(*) AS etab_tmp from etablissements_tmp;

View File

@ -0,0 +1,3 @@
DROP TABLE IF EXISTS jo.dirigeants_old;
RENAME TABLE jo.dirigeants TO jo.dirigeants_old;
RENAME TABLE jo.dirigeants_tmp TO jo.dirigeants;

View File

@ -0,0 +1,4 @@
DROP TABLE IF EXISTS jo.etablissements_old;
RENAME TABLE jo.etablissements TO jo.etablissements_old;
RENAME TABLE jo.etablissements_tmp TO jo.etablissements;
ALTER TABLE jo.etablissements_old ADD INDEX(source, siege, actif, adr_dep, capital, cj, ape_entrep, ape_etab, age_entrep, teff_entrep, teff_etab, tca);

147
initscript/sphinxsearch Normal file
View File

@ -0,0 +1,147 @@
#! /bin/sh
#
# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
# Modified for Debian
# by Ian Murdock <imurdock@gnu.ai.mit.edu>.
# Further changes by Javier Fernandez-Sanguino <jfs@debian.org>
# Modified for sphinx by Radu Spineanu <radu@debian.org>
#
#
### BEGIN INIT INFO
# Provides: sphinxsearch
# Required-Start: $local_fs $remote_fs $syslog $network $time
# Required-Stop: $local_fs $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Fast standalone full-text SQL search engine
### END INIT INFO
PREFIX=/usr/local/sphinx
DATA=/dbs/sphinx
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=$PREFIX/bin/searchd
NAME=sphinx
DESC=sphinx
test -x $DAEMON || exit 0
PIDFILE=/var/log/searchd.pid
DODTIME=1 # Time to wait for the server to die, in seconds
# If this value is set too low you might not
# let some servers to die gracefully and
# 'restart' will not work
# Include sphinx defaults if available
if [ -f /etc/default/sphinx ] ; then
. /etc/default/sphinx
fi
set -e
running_pid()
{
# Check if a given process pid's cmdline matches a given name
pid=$1
name=$2
[ -z "$pid" ] && return 1
[ ! -d /proc/$pid ] && return 1
cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1`
# Is this the expected child?
[ "$cmd" != "$name" ] && return 1
return 0
}
running()
{
# Check if the process is running looking at /proc
# (works for all users)
# No pidfile, probably no daemon present
[ ! -f "$PIDFILE" ] && return 1
# Obtain the pid and check it against the binary name
pid=`cat $PIDFILE`
running_pid $pid $DAEMON || return 1
return 0
}
force_stop() {
# Forcefully kill the process
[ ! -f "$PIDFILE" ] && return
if running ; then
kill -15 $pid
# Is it really dead?
[ -n "$DODTIME" ] && sleep "$DODTIME"s
if running ; then
kill -9 $pid
[ -n "$DODTIME" ] && sleep "$DODTIME"s
if running ; then
echo "Cannot kill $LABEL (pid=$pid)!"
exit 1
fi
fi
fi
rm -f $PIDFILE
return 0
}
case "$1" in
start)
echo -n "Starting $DESC: "
# Check if we have the configuration file
if [ ! -f /usr/local/sphinx/etc/sphinx.conf ]; then
echo "Please create an /usr/local/sphinx/sphinx.conf configuration file."
echo "Templates are in the directory."
exit 0
fi
start-stop-daemon --start --exec ${DAEMON}
if running ; then
echo "$NAME."
else
echo " ERROR."
fi
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE \
--exec $DAEMON
echo "$NAME."
;;
force-stop)
echo -n "Forcefully stopping $DESC: "
force_stop
if ! running ; then
echo "$NAME."
else
echo " ERROR."
fi
;;
restart)
echo -n "Restarting $DESC: "
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE \
--exec $DAEMON
[ -n "$DODTIME" ] && sleep $DODTIME
start-stop-daemon --start --exec ${DAEMON}
echo "$NAME."
;;
status)
echo -n "$LABEL is "
if running ; then
echo "running"
else
echo " not running."
exit 1
fi
;;
*)
N=/etc/init.d/$NAME
# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $N {start|stop|restart|force-reload|status|force-stop}" >&2
exit 1
;;
esac
exit 0

12
logrotate/searchd Normal file
View File

@ -0,0 +1,12 @@
/dbs/sphinxlog/query.log /dbs/sphinxlog/searchd.log {
missingok
notifempty
weekly
rotate 5
compress
delaycompress
create 640 root root
postrotate
killall -SIGUSR1 searchd
endscript
}