PostGresqL全文搜索字符问题

编程入门 行业动态 更新时间:2024-10-25 22:24:17
本文介绍了PostGresqL全文搜索字符问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

好的,我的问题是:我正在用法语字典使用postgresql的全文搜索,并且在我的数据库中有一些描述包含带有一个字符的名称,例如: Amphi 'A',Amphi'C,Amphi'D'... ,那么,当我使用tsvector auto创建触发器时,索姆名不会出现,Amphi AI 得到'amphi' :1'a':2但Amphi'C'是'amphi':1,没有它的名字。

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.

请帮我:D

推荐答案

那是因为f.ex 。 C 和 D 被认为是

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

您可以创建自定义字典(& a配置)而不被停止词:

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

更多推荐

PostGresqL全文搜索字符问题

本文发布于:2023-10-25 18:23:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1527727.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符   全文   PostGresqL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!