Reputation: 75
Well my problem is : I am using the full-text search of postgresql with a french dictionnary, and I have in my data base some descriptions that contains names with one character for exemple : Amphi 'A' , Amphi 'C, Amphi 'D' ... well, for that, when I use tsvector auto creation trigger, somme names don't appear, for Amphi A I got 'amphi':1 'a':2 but for Amphi 'C' is 'amphi':1 without the it's name.
please help me :D
Upvotes: 0
Views: 441
Reputation: 36244
That's because f.ex. C
and D
considered to be stop words in the french dictionary:
SELECT to_tsvector('french', 'Amphi A'); -- 'a':2 'amphi':1
SELECT to_tsvector('french', 'Amphi C'); -- 'amphi':1
You can create a custom dictionary (& a configuration for that) without stop words by:
CREATE TEXT SEARCH DICTIONARY french_stem_nostop(
TEMPLATE = snowball,
LANGUAGE = 'french'
);
CREATE TEXT SEARCH CONFIGURATION french_nostop(COPY = french);
ALTER TEXT SEARCH CONFIGURATION french_nostop
ALTER MAPPING FOR asciihword WITH french_stem_nostop;
ALTER TEXT SEARCH CONFIGURATION french_nostop
ALTER MAPPING FOR asciiword WITH french_stem_nostop;
ALTER TEXT SEARCH CONFIGURATION french_nostop
ALTER MAPPING FOR hword WITH french_stem_nostop;
ALTER TEXT SEARCH CONFIGURATION french_nostop
ALTER MAPPING FOR hword_asciipart WITH french_stem_nostop;
ALTER TEXT SEARCH CONFIGURATION french_nostop
ALTER MAPPING FOR hword_part WITH french_stem_nostop;
SELECT to_tsvector('french_nostop', 'Amphi C'); -- 'amphi':1 'c':2
Upvotes: 3