Re: Strange result for full text query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Johann Spies <johann(dot)spies(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Strange result for full text query
Date: 2014-03-25 13:56:56
Message-ID: 12332.1395755816@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Johann Spies <johann(dot)spies(at)gmail(dot)com> writes:
> I have a record with this in the 'ti' field:
> On type A and type B uncertainties and its propagation without
> derivatives: a contribution to incorporate contemporary metrology to
> Physics' laboratories in higher education

> and tsv contains the following for this record:

> "'activ':129 'altern':73,94 'assumpt':62 'b':6,39 'concept':28,122
> 'contemporari':17 'contribut':14 'deriv':12,91 'discuss':42
> 'earliest':127 'educ':24,133 'estim':76 'evalu':34 'experiment':128

What have you got default_text_search_config set to? Not "simple":

regression=# select to_tsvector('simple','higher education');
to_tsvector
--------------------------
'education':2 'higher':1
(1 row)

regression=# select to_tsvector('english','higher education');
to_tsvector
---------------------
'educ':2 'higher':1
(1 row)

> When I use the query

> select ut, ti
> from isi.ritem A
> where
> A.tsv @@ to_tsquery('Simple','higher & education')

> The result is zero.

> But then I use

> A.tsv @@ to_tsquery('Simple','higher & educ')

> I get more than 54000 records as result.

Not surprising: the simple config doesn't assume the lexemes are English
words.

regression=# select to_tsquery('Simple','higher & education');
to_tsquery
------------------------
'higher' & 'education'
(1 row)

regression=# select to_tsquery('english','higher & education');
to_tsquery
-------------------
'higher' & 'educ'
(1 row)

> That makes me think the full text search is probably not very reliable.

If misused, yeah. You need to have a fairly clear idea of which language
you are indexing; or maybe I should just say that you need to use a
consistent text search configuration selection. (Words in other languages
will still work, they just might not get stemmed usefully.)

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marcus Engene 2014-03-25 14:22:34 insert data over dblink from bulk select of local table
Previous Message Frank Foerster 2014-03-25 13:56:48 Is it possible to "pip" pg_dump output into new db ?