BUG #13690: Full Text Search with spanish dictionary cannot find some words - Mailing list pgsql-bugs

From vtamara@pasosdeJesus.org
Subject BUG #13690: Full Text Search with spanish dictionary cannot find some words
Date
Msg-id 20151020110857.3017.63066@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #13690: Full Text Search with spanish dictionary cannot find some words  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      13690
Logged by:          Vladimir Támara Patiño
Email address:      vtamara@pasosdeJesus.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:*');

pgsql-bugs by date:

Previous
From: John R Pierce
Date:
Subject: Re: database and table information collect
Next
From: Bruce Momjian
Date:
Subject: Re: BUG #13689: Build failed pg9.4.5 with mingw5.1