text search synonym dictionary anomaly with numbers

From: Richard Greenwood <richard(dot)greenwood(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: text search synonym dictionary anomaly with numbers
Date: 2011-11-27 01:47:43
Message-ID: CAHBySPY9s-uLVhBoNLBVK1cz1yE3APRJVRfA3U5Xp=_zBpFXHw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am working with street address data in which 'first st' has been
entered as '1 st' and so on. So I have created a text search
dictionary with entries:
first 1
1st 1
And initially it seems to be working properly:

SELECT ts_lexize('rwg_synonym','first');
ts_lexize
-----------
{1}

SELECT ts_lexize('rwg_synonym','1st');
ts_lexize
-----------
{1}

But my queries on '1st' are not returning the expected results:

SELECT count(*) FROM parcel_attrib WHERE txtsrch @@ to_tsquery('1');
count
-------
403 <- this is what I want

SELECT count(*) FROM parcel_attrib WHERE txtsrch @@ to_tsquery('first');
count
-------
403 <- this is also good

SELECT count(*) FROM parcel_attrib WHERE txtsrch @@ to_tsquery('1st');
count
-------
4 <- this is not good. There are 4 records that do have '1st',
but why am I not getting 403 records?

Thanks for reading,
Rich

--
Richard Greenwood
richard(dot)greenwood(at)gmail(dot)com
www.greenwoodmap.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gaëtan Allart 2011-11-27 09:45:50 Re: General performance/load issue
Previous Message Tomas Vondra 2011-11-27 00:28:16 Re: General performance/load issue