[mapserver-users] Re: postgres fulltext search

Steve Grey stevegrey78 at gmail.com
Wed May 5 18:22:54 EDT 2010


Matt,

Just picked up on the thead, sorry for the late posting.  In PostgreSQL, for
full-text indexing in TSearch2 (don't know if your FTS experience is with
PG), you can also build with plainto_tsquery(), and if you want to avoid the
dictionary stemming etc., prepare the index and use the search with 'simple'
- i.e. to_tsvector('simple',my_field).  This allows you to match words from
a supplied phrase, rather than the phrase itself as with @@, and use
rankings, similarity etc. to score your results.

Alternatively, preparing a btree index with a varchar_pattern_ops or
text_pattern_ops opclass (see
http://www.postgresql.org/docs/current/static/indexes-opclass.html) allows
the use of like, so long as the search is anchored at the start of the term.

Steve



On 5 May 2010 17:25, mattmendick <matt.mendick at pictometry.com> wrote:

>
> Andy-
>
> Thanks a ton for taking a look at this for me. In looking around some more
> talking about variable substitution, I found that I can do a FILTER like
> you
> mentioned in the layer section of the mapfile. I could do a:
>
> FILTER "city @@ ts_vector('%mycitysearch%')"
>
> and then in the mapserver request url, add a &mycitysearch=new york, this
> will work (I tried it using FILTER "city = '%mycitysearch%'", and it worked
> perfectly. I don't have the full-text set up yet on my server, but i've
> done
> it in the past.)  It's too bad I can't do it with the normal PropertyIsLike
> syntax, but it seems that if I wanted to hack up the code for our own
> installation, I could replace the sql building code with my own.
>
> Thanks very much for your help, you've answered a lot of my questions!
>
> -Matt
> --
> View this message in context:
> http://osgeo-org.1803224.n2.nabble.com/postgres-fulltext-search-tp5009033p5009786.html
> Sent from the Mapserver - User mailing list archive at Nabble.com.
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20100505/f2782590/attachment.html


More information about the mapserver-users mailing list