Re: General search problem - challenge

From: Richard Huxton <dev(at)archonet(dot)com>
To: Postgres User <postgres(dot)developer(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: General search problem - challenge
Date: 2007-07-03 08:57:29
Message-ID: 468A0F79.90900@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Postgres User wrote:
> I have a table of around 6,000 places in the world. Everytime my
> server receives a ping, I'm grabbing the content of an article from an
> RSS feed. Then I search the article for the presence of any the 6000
> terms.
> A typical article is around 1200 words.
>
> I don't need to save the article in a table and the search is
> performed only once, so it's not about FTS.
>
> Any thoughts on the best way to execute these searches using a
> traditional language like C++ ?

Not sure that it's got anything to do with PostgreSQL.

1. Pre-process the 6000 words into a hash-lookup-table using hash
library of choice.

2. Split the article into "words" (however you define that)
3. Use your hash table to lookup each word from the article.
4. Stop on first match

Like Steve Atkins says, I'd use Perl instead of C++ and go home early :-)

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2007-07-03 09:03:55 Re: How-To: Aggregate data from multiple rows into a delimited list.
Previous Message Dimitri Fontaine 2007-07-03 08:47:04 Re: How-To: Aggregate data from multiple rows into a delimited list.