Обсуждение: Question with tsearch2 (or it might be a general one too)

Поиск
Список
Период
Сортировка

Question with tsearch2 (or it might be a general one too)

От
Ritesh Nadhani
Дата:
Hello

A newbie to PostgreSQL from MySQL and just trying to learn tsearch2. In
one of the examples at:

http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/docs/tsearch-V2-intro.html

the query given is:

SELECT intindex, strTopic FROM tblmessages
                 WHERE idxfti @@ to_tsquery('default', 'gettysburg &
address')
                 AND strMessage ~* '.*men are created equal.*';

What does the '@@' in the query means?

I did a search at:


http://search.postgresql.org/www.search?ul=http%3A%2F%2Fwww.postgresql.org%2Fdocs%2F8.1%2Finteractive%2F%25&fm=on&cs=utf-8&q=%40%40

an it dosnt return any result.

Is this specific to tsearch2? What does that mean?

Ritesh

Re: Question with tsearch2 (or it might be a general one too)

От
"Gregory S. Williamson"
Дата:
Ritesh --

You are correct in thinking that "@@" is a special operator defined for tesearch2; it uses the GIST indexes to do a
search,but more than that I can't say, since I am not really familiar with tsearch2. (In the postGIS world there is a
vaguelyequivalent operator, "&&", again using postgres' ability to define ones own data types and functions. 

HTH,

Greg Williamson
DBA
GlobeXplorer LLC


-----Original Message-----
From:    pgsql-general-owner@postgresql.org on behalf of Ritesh Nadhani
Sent:    Thu 10/19/2006 11:38 AM
To:    pgsql-general@postgresql.org
Cc:
Subject:    [GENERAL] Question with tsearch2 (or it might be a general one too)

Hello

A newbie to PostgreSQL from MySQL and just trying to learn tsearch2. In
one of the examples at:

http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/docs/tsearch-V2-intro.html

the query given is:

SELECT intindex, strTopic FROM tblmessages
                 WHERE idxfti @@ to_tsquery('default', 'gettysburg &
address')
                 AND strMessage ~* '.*men are created equal.*';

What does the '@@' in the query means?

I did a search at:


http://search.postgresql.org/www.search?ul=http%3A%2F%2Fwww.postgresql.org%2Fdocs%2F8.1%2Finteractive%2F%25&fm=on&cs=utf-8&q=%40%40

an it dosnt return any result.

Is this specific to tsearch2? What does that mean?

Ritesh

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org/


-------------------------------------------------------
Click link below if it is SPAM gsw@globexplorer.com

"https://mailscanner.globexplorer.com/dspam/dspam.cgi?signatureID=453969c4232531465134470&user=gsw@globexplorer.com&retrain=spam&template=history&history_page=1"
!DSPAM:453969c4232531465134470!
-------------------------------------------------------






Re: Question with tsearch2 (or it might be a general one

От
Chris
Дата:
Ritesh Nadhani wrote:
> Hello
>
> A newbie to PostgreSQL from MySQL and just trying to learn tsearch2. In
> one of the examples at:
>
> http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/docs/tsearch-V2-intro.html
>
>
> the query given is:
>
> SELECT intindex, strTopic FROM tblmessages
>                 WHERE idxfti @@ to_tsquery('default', 'gettysburg &
> address')
>                 AND strMessage ~* '.*men are created equal.*';
>
> What does the '@@' in the query means?

It is specific to tsearch2 and it tells postgres how to do the
comparison between the two items - much the same as '=' or '>' do.

If you log in to psql and do:

\do @@

It will list all '@@' operators and show you what data etc it will be
expecting in each case (each operator can be used in a different context
depending on what type of data you're using).

If you really want to look at what it does, look at the tsearch2 source
code, it'd be in there somewhere (grep for 'create operator' and go from
there).

--
Postgresql & php tutorials
http://www.designmagick.com/