Re: Simplifying Text Search - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: Simplifying Text Search
Date
Msg-id 87wssmjqc9.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: Simplifying Text Search  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Simplifying Text Search  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
"Peter Eisentraut" <peter_e@gmx.net> writes:

> What we'd need is a way to convert a LIKE pattern into a tsquery ('%foo%bar%' 
> => 'foo & bar').  Then you might even be able to sneak index-optimized text 
> search into existing applications.  Might be worth a try.

I don't think that's the right direction to go. Notably "%foo%bar%" isn't the
same thing as "foo & bar". Also most tsearch queries can't be expressed as
LIKE patterns anyways.


What I do like is the idea of using LIKE as a model to follow for tsearch.
Make some keyword which maps to an operator. So you could do something like
WHERE col SATISFIES 'foo & bar'

which maps to @@ just as LIKE maps to ~~. This has the interesting property of
working for ltree and other data types which support the @@ operator.

Now I'm starting to wonder though. How evil would it be to just rename all the
@@ operators to ~~ ? That redefines LIKE to be a data-type-specific operation.
Effectively declaring that tsquery, lquery, et al are all analogous concepts
for LIKE patterns.

It's probably safer to come up with a new keyword for @@ and if we ever decide
to pursue a regexp data type we could define @@ for that as well which would
make that keyword an equivalent to LIKE for regexps.

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com Ask me about EnterpriseDB's RemoteDBA services!


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Simplifying Text Search
Next
From: Peter Eisentraut
Date:
Subject: Re: Simplifying Text Search