Strange result for full text query

From: Johann Spies <johann(dot)spies(at)gmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Strange result for full text query
Date: 2014-03-25 07:47:34
Message-ID: CAGZ55DT2a5r2g32Ps24XGSB_XFvHQTRC6wMJOSvqRyKZ+F4ZPg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 there is a tsv-field which is updated by the following trigger function:

CREATE OR REPLACE FUNCTION isi.update_ritem_tsv()
RETURNS trigger AS
$BODY$

begin

new.tsv := to_tsvector(coalesce(new.ti,'')) ||
to_tsvector(coalesce(new.ab,''));

return new;

end
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION isi.update_ritem_tsv()
OWNER TO crest;

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
'explicit':87 'express':54 'goal':65 'guid':51 'higher':23,132
'incorpor':16 'input':82 'introduc':26,71 'introduct':119
'laboratori':21,135 'law':44,106 'main':64 'measur':58
'metrolog':18,121 'output':84 'paper':68 'partial':90 'perceiv':114
'perform':130 'physic':20,134 'possibl':112 'procedur':32,74,95,124
'propag':10,46,79,108 'quantiti':85 'refer':88 'relat':97 'share':100
'simpl':98 'type':2,5,35,38 'uncertainti':7,30,40,48,56,77 'under':61
'valid':103 'valu':116 'without':11,86"

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.

and with

A.tsv @@ to_tsquery('Simple','education')

I get 19 records containing words like Educatione, educationism, Education
etc.

That makes me think the full text search is probably not very reliable.
Why this results?

Regards
Johann

--
Because experiencing your loyal love is better than life itself,
my lips will praise you. (Psalm 63:3)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Frank Foerster 2014-03-25 13:56:48 Is it possible to "pip" pg_dump output into new db ?
Previous Message John R Pierce 2014-03-25 06:39:11 Re: Upgrading from 9.2 to 9.3 causes performance degradation