Buscar este blog

lunes, 16 de mayo de 2016

PostgreSQL - ERROR: text search configuration "public.default_spanish" does not exist

This error appears when you try to make a search and there is no search engine configured. With text search, postgreSQL is able to parse string fields and split their content in text elements.

The first step is to configure the text search (http://www.postgresql.org/docs/9.5/static/sql-createtsconfig.html). Just execute the following sentence in the query interpreter:

CREATE TEXT SEARCH DICTIONARY default_spanish (
    TEMPLATE = pg_catalog.ispell,
    dictfile = 'es_es', afffile = 'es_es', stopwords = 'es_es' );


Now, when you repeat the text query you will get the following error:
ERROR:  no se pudo abrir el archivo de diccionario «C:/Program Files (x86)/PostgreSQL/9.4/share/tsearch_data/es_es.dict»: No such file or directory


So, you need more things:
  • A dictionary. This file contains a list of words used in this language, but wich are not stop words.
  • A list of stop words. Stop words are used to eliminate very frequent words that contain no or little information to help discriminate the text they occur in.
  • A list prefix/sufix (affix). This file contains common variations of words in this language.

The dictionary and the affix file can be found here: http://fmg-www.cs.ucla.edu/geoff/ispell-dictionaries.html

The stop words can be found here: http://snowball.tartarus.org/

Just put this files in the directory shown in the previous error string.

No hay comentarios:

Publicar un comentario