Thread: Re: Tsearch

Re: Tsearch

From
Steve Midgley
Date:
At 12:20 PM 6/12/2008, pgsql-sql-owner@postgresql.org wrote:
>Date: Thu, 12 Jun 2008 08:47:44 -0400
>From: PostgreSQL Admin <postgres@productivitymedia.com>
>To: pgsql-sql@postgresql.org
>Subject: Tsearch
>Message-ID: <48511AF0.30306@productivitymedia.com>
>
>this is a small sample of the data:
>
>                         short_desc
>|                               long_desc 
>

>----------------------------------------------------------+------------------------------------------------------------------------
>  CHICKEN,BROILERS OR FRYERS,LEG,MEAT&SKN,CKD,FRIED,BATTER | Chicken,
>broilers or fryers, leg, meat and skin, cooked, fried, batter
>
>Is the best method of search through this data full text search via
>tsearch or some other method.  I'm running version 8.3
>
>say I want to search for chicken skin?
>
>Thanks for the advice,
>J

Having previously established myself as a non-expert on TSearch2, I 
hesitate to post, but I think your issue is data semantics more than 
search tool. How do you want your system to handle this psuedo data:

Chicken broilers, pork skins

Should that return a match for "chicken skins" or not? If your data are 
semantically stored such that any record that matches "chicken" and 
also matches "skin" refers to "the skins of chickens" (the actual 
meaning you are looking for), then you're going to have a relatively 
easy time of it.

If not, you'll have to consider ways to code your data so that searches 
behave correctly. You could develop search / coding schemes that say 
things like "find all records with chicken and skin, where the 
following words do not appear between the words chicken and skin: beef, 
pork, cow, pig, etc.."

Just some thoughts for you there.

Best,

Steve