vtamara@pasosdeJesus.org writes:
> 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:*'
> );
This is because you didn't adjust the wildcard search pattern for the
different stemming rules used in Spanish. Look at the to_tsvector and
to_tsquery results:
regression=# SELECT to_tsvector('english', nombre) , to_tsquery('english','politi:*') from cat;
to_tsvector | to_tsquery
-------------------------+------------
'politica':1 'social':2 | 'politi':*
(1 row)
regression=# SELECT to_tsvector('spanish', nombre) , to_tsquery('spanish','politi:*') from cat;
to_tsvector | to_tsquery
----------------------+------------
'polit':1 'social':2 | 'politi':*
(1 row)
I don't know enough Spanish to follow the reasoning for stemming
"politica" as "polit" rather than something else; but I do see that
"politi" is not reduced to "polit", which is fairly reasonable since
that's not a word. "politi:*" will match anything whose stemmed
version starts with "politi", but that's too long ...
regards, tom lane