pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #14278: Problem searching spanish words with accent mark outside the stem
4+ messages / 4 participants
[nested] [flat]
* BUG #14278: Problem searching spanish words with accent mark outside the stem
@ 2016-08-04 10:25 paco@hernandezgomez.com
0 siblings, 1 reply; 4+ messages in thread
From: paco@hernandezgomez.com @ 2016-08-04 10:25 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 14278
Logged by: Paco Hernández
Email address: paco@hernandezgomez.com
PostgreSQL version: 9.6beta3
Operating system: Linux
Description:
Dear sirs:
Search without accent mark is not working correctly when the accent mark is
outside the stem of the word.
For example, this matches correctly:
postgres=# select to_tsvector('spanish', 'canción') @@ to_tsquery('spanish',
'cancion');
?column?
----------
t
(1 row)
This works and returns true because the stem of "canción" is "cancion", so
when we search for "cancion" (without accent mark), it matches correctly.
But, when the accent mark is outside the stem, for example in "peluquería",
then it does not work because the stem of "peluquería" is "peluqu", but
to_tsquery('spanish', 'peluqueria') is "peluqueri".
postgres=# select to_tsvector('spanish', 'peluquería') @@
to_tsquery('spanish', 'peluqueria');
?column?
----------
f
(1 row)
This is important because there are many people that don't use the accent
mark at letter "i" in "peluquería" and words like that.
Thank you very much.
Best regards,
Paco Hernández.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #14278: Problem searching spanish words with accent mark outside the stem
@ 2016-08-08 04:58 Alvaro Herrera <alvherre@2ndquadrant.com>
parent: paco@hernandezgomez.com
0 siblings, 2 replies; 4+ messages in thread
From: Alvaro Herrera @ 2016-08-08 04:58 UTC (permalink / raw)
To: paco@hernandezgomez.com; +Cc: pgsql-bugs
paco@hernandezgomez.com wrote:
> Search without accent mark is not working correctly when the accent mark is
> outside the stem of the word.
I think it'd be better to apply unaccent() to both the stored text
before ts_vectorization and to the query terms. That would reliably
remove all diacritics (eñes too, though I suppose nobody would search
for their ñandúes by writing nandú, so it's not as severe).
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #14278: Problem searching spanish words with accent mark outside the stem
@ 2016-08-08 05:27 Jaime Casanova <jaime.casanova@2ndquadrant.com>
parent: Alvaro Herrera <alvherre@2ndquadrant.com>
1 sibling, 0 replies; 4+ messages in thread
From: Jaime Casanova @ 2016-08-08 05:27 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: paco@hernandezgomez.com; pgsql-bugs
On 7 August 2016 at 23:58, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
> paco@hernandezgomez.com wrote:
>
>> Search without accent mark is not working correctly when the accent mark is
>> outside the stem of the word.
>
> I think it'd be better to apply unaccent() to both the stored text
> before ts_vectorization and to the query terms. That would reliably
> remove all diacritics (eñes too, though I suppose nobody would search
> for their ñandúes by writing nandú, so it's not as severe).
>
>
problem is that unaccent() is stable so can't be in the index
expression, so OP would need to create a ts_vector field to store a
preprocessed version of the string (one in which ts_vector('spanish',
unaccent()) has been already executed. and query over that field.
<cough> or create an immutable version of unaccent() </cough>
--
Jaime Casanova www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #14278: Problem searching spanish words with accent mark outside the stem
@ 2016-08-08 08:07 pacohernandezg <paco@hernandezgomez.com>
parent: Alvaro Herrera <alvherre@2ndquadrant.com>
1 sibling, 0 replies; 4+ messages in thread
From: pacohernandezg @ 2016-08-08 08:07 UTC (permalink / raw)
To: pgsql-bugs
Thank you very much Álvaro.
It is perfect for us, once you apply unaccent.
We have finally altered spanish config with:
alter text search configuration spanish
alter mapping for hword, hword_part, word with unaccent, spanish_stem;
And it is working perfectly.
Thanks again. ;-)
--
View this message in context: http://postgresql.nabble.com/BUG-14278-Problem-searching-spanish-words-with-accent-mark-outside-the-...
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2016-08-08 08:07 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-08-04 10:25 BUG #14278: Problem searching spanish words with accent mark outside the stem paco@hernandezgomez.com
2016-08-08 04:58 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2016-08-08 05:27 ` Jaime Casanova <jaime.casanova@2ndquadrant.com>
2016-08-08 08:07 ` pacohernandezg <paco@hernandezgomez.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox