diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-03-01 13:22:03 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-03-01 13:22:03 +0100 |
commit | 1924bd4b1286d8dbd761be0a7824a161ccaa99fd (patch) | |
tree | 4f34c0412fa8aa83812ea6ffe48c48ef7fe893e2 | |
parent | b0a3c3b146ebf670838fc7f919ff73c2ef16c6f3 (diff) | |
download | Ishtar-1924bd4b1286d8dbd761be0a7824a161ccaa99fd.tar.bz2 Ishtar-1924bd4b1286d8dbd761be0a7824a161ccaa99fd.zip |
Free text search: add french_archeo thesaurus config
-rw-r--r-- | CHANGES.md | 1 | ||||
-rw-r--r-- | postgres/french/create.sql | 23 | ||||
-rwxr-xr-x | postgres/french/install_dict.sh | 32 | ||||
-rw-r--r-- | postgres/french/thesaurus_french_archeo.ths | 11 |
4 files changed, 67 insertions, 0 deletions
diff --git a/CHANGES.md b/CHANGES.md index f89848dd4..a1e49befd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -19,6 +19,7 @@ Ishtar changelog - overload index to add subsection headers - Geo: create/edit form - new openlayers version - add default IGN tiles - Import: improve bad encoding detection +- Free text search: add french_archeo thesaurus config ### Bug fixes ### - Search: Fix many excluded search diff --git a/postgres/french/create.sql b/postgres/french/create.sql new file mode 100644 index 000000000..4f1b9ee0e --- /dev/null +++ b/postgres/french/create.sql @@ -0,0 +1,23 @@ +DROP TEXT SEARCH CONFIGURATION IF EXISTS french_archeo; +DROP TEXT SEARCH DICTIONARY IF EXISTS thesaurus_french_archeo; + + +CREATE TEXT SEARCH CONFIGURATION french_archeo ( + COPY = french +); + +ALTER TEXT SEARCH CONFIGURATION french_archeo + DROP MAPPING FOR hword_asciipart; +ALTER TEXT SEARCH CONFIGURATION french_archeo + DROP MAPPING FOR hword_part; + + +CREATE TEXT SEARCH DICTIONARY thesaurus_french_archeo ( + TEMPLATE = thesaurus, + DictFile = thesaurus_french_archeo, + Dictionary = pg_catalog.simple +); + +ALTER TEXT SEARCH CONFIGURATION french_archeo + ALTER MAPPING FOR asciihword, asciiword, hword, word + WITH thesaurus_french_archeo, french_stem; diff --git a/postgres/french/install_dict.sh b/postgres/french/install_dict.sh new file mode 100755 index 000000000..d8abfa098 --- /dev/null +++ b/postgres/french/install_dict.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +set -e + +MSG="install_dict.sh dbname [PG_SEARCH_DIR_PATH]" +if [ $# -eq 0 ]; then + echo $MSG + exit 1 +fi + +DB=$1 +PG_DIR=/usr/share/postgresql/13/ +PG_SEARCH_DIR="$PG_DIR"tsearch_data +if [ $# -eq 2 ]; then + PG_SEARCH_DIR=$2 +fi + +rm -f $PG_SEARCH_DIR/thesaurus_french_archeo.ths +ln -s `pwd`/thesaurus_french_archeo.ths $PG_SEARCH_DIR/ + +systemctl restart postgresql +touch /tmp/install_error +sudo -u postgres psql -d $1 -f create.sql > /dev/null 2> /tmp/install_error + +if grep ERR /tmp/install_error; then + exit 1; +fi + +echo '"french_archeo" dictionnary successfully installed for '$DB +echo 'Change your django local_settings.py file to add the line:' +echo 'ISHTAR_SEARCH_LANGUAGE = "french_archeo"' + diff --git a/postgres/french/thesaurus_french_archeo.ths b/postgres/french/thesaurus_french_archeo.ths new file mode 100644 index 000000000..0a7da923f --- /dev/null +++ b/postgres/french/thesaurus_french_archeo.ths @@ -0,0 +1,11 @@ +menhir : menh +menhirs : menh +terre: terre +terrasse : terrasse +terrain : terrain +terrains : terrain +granulo : granulo +collective : collective +collectives : collective +collection : collection +collections : collection |