BUG #13690: Full Text Search with spanish dictionary cannot find some words

From: vtamara(at)pasosdeJesus(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #13690: Full Text Search with spanish dictionary cannot find some words
Date: 2015-10-20 11:08:57
Message-ID: 20151020110857.3017.63066@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 13690
Logged by: Vladimir Támara Patiño
Email address: vtamara(at)pasosdeJesus(dot)org
PostgreSQL version: 9.4.5
Operating system: adJ/OpenBSD
Description:

Consider the following table with one register:

CREATE TABLE cat (
nombre character varying(500)
);

INSERT INTO cat (nombre) VALUES ('Politica Social');

The following search in english succeeds (returns 1):

SELECT COUNT(*) FROM cat
WHERE to_tsvector('english', nombre) @@ to_tsquery('english',
'politi:*'
);

But fails using the spanish dictionary (returns 0):

SELECT COUNT(*) FROM cat
WHERE to_tsvector('spanish', nombre) @@ to_tsquery('spanish',
'politi:*'
);

In all the cases I tried, the search with the english dictionary succeeded.

However using the spanish dictionary the search will succed for example with
'poli', 'polit', 'politica' but will fail with 'politi' and 'politic'

I'm using the dictionary of stop words included with PostgreSQL 9.4.5.

I also tested in a PostgreSQL 9.1.12 running on a Linux Ubuntu 15.04, and I
observed exactly the same error using spanish dictionary (can find 'polit'
and 'politica' but cannot find 'politi' neither 'politic').

Here is the SQL I'm using for testing:

CREATE TABLE cat (
nombre character varying(500)
);

INSERT INTO cat (nombre) VALUES ('Politica Social');

SELECT COUNT(*) FROM cat
WHERE to_tsvector('spanish', nombre) @@ to_tsquery('spanish',
'polit:*');
SELECT COUNT(*) FROM cat
WHERE to_tsvector('english', nombre) @@ to_tsquery('english',
'polit:*');
SELECT COUNT(*) FROM cat
WHERE to_tsvector('spanish', nombre) @@ to_tsquery('spanish',
'politi:*'); -- Error gives 0 should be 1
SELECT COUNT(*) FROM cat
WHERE to_tsvector('english', nombre) @@ to_tsquery('english',
'politi:*');
SELECT COUNT(*) FROM cat
WHERE to_tsvector('spanish', nombre) @@ to_tsquery('spanish',
'politic:*'); -- Error gives 0 should be 1
SELECT COUNT(*) FROM cat
WHERE to_tsvector('english', nombre) @@ to_tsquery('english',
'politic:*');
SELECT COUNT(*) FROM cat
WHERE to_tsvector('spanish', nombre) @@ to_tsquery('spanish',
'politica:*');
SELECT COUNT(*) FROM cat
WHERE to_tsvector('english', nombre) @@ to_tsquery('english',
'politica:*');

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2015-10-20 14:40:43 Re: BUG #13689: Build failed pg9.4.5 with mingw5.1
Previous Message John R Pierce 2015-10-20 05:15:58 Re: database and table information collect