Search Postgresql Archives

Full text search prefix matching

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I’m trying to use PostgreSQL's full text search for searching names with prefix matching. I’ve got a materialized view with the  tsvector’s in an indexed column which I’m then searching with prefix matching, as in the sqlfiddle: http://sqlfiddle.com/#!15/a2389/6 and below.

My problem is that when using the ‘finnish’ text search configuration, the names are split before the end, and they’re not matched when searching with prefix search that has exactly one character more than the lexeme, as also demonstrated in the above fiddle. When there are two characters after the lexeme, it does match.

I’m working around the issue by using ‘simple’ configuration, which includes the full words in the lexemes.

Should text search prefixes work predicatably as documented in [1] even if the lexemes are shorter than the query? How can I get it to work?

Best regards,

Heikki Rauhala


[1] http://www.postgresql.org/docs/9.3/static/textsearch-controls.html#TEXTSEARCH-PARSING-QUERIES

create table names (name varchar);
insert into names (name) values ('Sofia');

create materialized view name_fulltext as
  select
    name,
    to_tsvector('finnish', name) as
      searchable_index_col
  from names;

select * from name_fulltext;
select to_tsquery('finnish','sof:*');

select 'found sof', name 
from name_fulltext 
where searchable_index_col@@to_tsquery('finnish','sof:*');

select 'notfound sofi', name 
from name_fulltext 
where searchable_index_col@@to_tsquery('finnish','sofi:*');

select 'found sofia', name 
from name_fulltext 
where searchable_index_col@@to_tsquery('finnish','sofia:*');

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux