Re: Tsearch2: casting text to tsquery - Mailing list pgsql-general

From Oleg Bartunov
Subject Re: Tsearch2: casting text to tsquery
Date
Msg-id Pine.GSO.4.63.0511161548440.29329@ra.sai.msu.su
Whole thread Raw
In response to Tsearch2: casting text to tsquery  (Alexander Presber <aljoscha@weisshuhn.de>)
Responses Re: Tsearch2: casting text to tsquery  (Alexander Presber <aljoscha@weisshuhn.de>)
List pgsql-general
On Wed, 16 Nov 2005, Alexander Presber wrote:

> Hello,
>
> I have a question that arose while using tsearch on a large database of book
> information.
>
> In order to inject unstemmed + stemmed versions of searchstrings into a query
> we want to cast an expression of type text to tsquery.
> Unfortunately
>
> SELECT 'word'::tsquery
>
> (where the literal 'word' is of type 'unknown' seemingly) works just fine
> while e.g.
>
> SELECT ('word' || '&fullword')::tsquery
>
> or, simpler
>
> SELECT 'word&fullword'::text::tsquery
>
> gives
>
> ERROR:  cannot cast type text to tsearch2.tsquery
>
> How can we work around that? Thanks for any help

no workaround needed. to_tsquery provides everything you need. If you
want fancy-shmancy solution you could always write wrapper around tsquery, but
I doubt you enter queries by hand, so why do you bothering ?

>
> Sincerely yours
> Alexander Presber
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

     Regards,
         Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

pgsql-general by date:

Previous
From: Thies C Arntzen
Date:
Subject: shouldn't postgres know the numer of rows in a (sorted) result-set before returning the first row?
Next
From: Richard Huxton
Date:
Subject: Re: shouldn't postgres know the numer of rows in a (sorted)