Re: Searching a gin index

From: James Dooley <jamdooley(at)gmail(dot)com>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Searching a gin index
Date: 2009-02-06 15:18:53
Message-ID: c01aff630902060718o4db78747j1b79bdc733cadaa3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Feb 6, 2009 at 4:01 PM, Richard Huxton <dev(at)archonet(dot)com> wrote:

> James - don't repeat the whole of the previous message in your replies,
> trim it to the relevant part. The message is already archived on the list.
>
> James Dooley wrote:
> > Oleg, but I am only interested in whether or not the syntax of my
> > search-query is correct.
> >
> > Having created the index as I mentioned above, would the correct way of
> > searching and using that index be
> >
> > ... AND (title || '' || description || '' || name) @@
> plainto_tsquery('car')
>
> That looks like a correct syntax, but it's unlikely to use your index -
> your index was created on to_tsvector('my_config', ...)

Got it, I will use the same function and parameters as the one created on
the index. As a matter a fact now the index seems to be used after I added
the strip(to_tsvector(...))

Good!!

>
> > or should it be as Richard just mentioned
> >
> > ... AND to_tsvector(title || '' || description || '' || name) @@
> > plainto_tsquery('car')
> >
> > or some other way ?
>
> Try playing around with the example I gave, and try variations on it. Do
> you understand why you have to supply a config when creating the
> functional index? Do you understand the difference between
> plainto_tsquery() and to_tsquery()?

Yes, I do understand the difference.

>
> --
> Richard Huxton
> Archonet Ltd
>

Now everything is working, I added my config to

plainto_tsquery('my_config', 'cars')

and I get results back. I find that strange though since I set the default
to be by config, but appearantly that was just temporary and for the PID
that changed it. Running from my app seemed to keep using the old
configuration.

Thanks all for your help.

Now I have a complete and working fulltext search!

PostgreSQL rules!!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2009-02-06 15:23:17 Re: Searching a gin index
Previous Message Oleg Bartunov 2009-02-06 15:11:43 Re: Searching a gin index