Search Postgresql Archives

Re: Full text search prefix matching

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

 



Heikki Rauhala <heikki.rauhala@xxxxxxxxxx> writes:
> 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?

I believe what you're seeing can be explained by these observations:

regression=# select to_tsvector('finnish', 'sofia');
 to_tsvector 
-------------
 'sof':1
(1 row)

regression=# select to_tsquery('finnish','sofia:*');
 to_tsquery 
------------
 'sof':*
(1 row)

regression=# select to_tsquery('finnish','sofi:*');
 to_tsquery 
------------
 'sofi':*
(1 row)

regression=# select to_tsquery('finnish','sof:*');
 to_tsquery 
------------
 'sof':*
(1 row)

What this shows is that the finnish configuration includes a word-stemming
rule that strips off "ia".  It won't strip off just "i" though, so "sofi"
doesn't get reduced to the same root and therefore doesn't match "sofia".
The "*" addition does nothing for you here since it allows matching in
the other direction (query shorter than target).

I know nothing of Finnish so I can't say just how correct these particular
stemming rules are for that language; perhaps they need adjustment.  But
it seems to me that if you want blind non-language-aware prefix matching,
you probably don't want the full-text-search machinery at all.  Full text
search is meant to deal with words, both in the documents and the queries.
You might take a look at pg_trgm as an alternative.

			regards, tom lane


-- 
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