Re: Strange result for full text query - Mailing list pgsql-general

From Tom Lane
Subject Re: Strange result for full text query
Date
Msg-id 12332.1395755816@sss.pgh.pa.us
Whole thread Raw
In response to Strange result for full text query  (Johann Spies <johann.spies@gmail.com>)
List pgsql-general
Johann Spies <johann.spies@gmail.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


pgsql-general by date:

Previous
From: Johann Spies
Date:
Subject: Strange result for full text query
Next
From: Marcus Engene
Date:
Subject: insert data over dblink from bulk select of local table