471,354 Members | 2,107 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

tsearch2 question...

Hello,

I have a quick question regarding tsearch2, hopefully this is an okay
place to ask because I couldn't find a tsearch2-specific mailing list..

Anyways, when the field which is indexed using tsearch2 is displayed in
it's entirety I want the searched keywords to be highlighted, just as in
a headline except that the entire document gets displayed instead of just
a summary of it..

In order for this to work well, it would seem that I need the same code
path as that used to generate the headline to begin with, otherwise
differences in stemming/etc could cause mis-matches...

My thought was to do:

SELECT bodytext_id,headline(bodytext,
to_tsquery('default','SEARCH_KEYS'),'
MaxWords=999999999,MinWords=999999999,ShortWord=0' ) FROM some_table WHERE
bodytext_id=SOME_ID

Does this seem like a 'reasonable' way to do this?... In not is there a
better way that you can think of?...

Thanks!

- GReg
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #1
1 1081


Net Virtual Mailing Lists wrote:
Hello,

I have a quick question regarding tsearch2, hopefully this is an okay
place to ask because I couldn't find a tsearch2-specific mailing list..

Anyways, when the field which is indexed using tsearch2 is displayed in
it's entirety I want the searched keywords to be highlighted, just as in
a headline except that the entire document gets displayed instead of just
a summary of it..

In order for this to work well, it would seem that I need the same code
path as that used to generate the headline to begin with, otherwise
differences in stemming/etc could cause mis-matches...

My thought was to do:

SELECT bodytext_id,headline(bodytext,
to_tsquery('default','SEARCH_KEYS'),'
MaxWords=999999999,MinWords=999999999,ShortWord=0' ) FROM some_table WHERE
bodytext_id=SOME_ID

Does this seem like a 'reasonable' way to do this?... In not is there a
better way that you can think of?...


Big value of MinWord is right way.
--
Teodor Sigaev E-mail: te****@sigaev.ru
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Nigel J. Andrews | last post: by
1 post views Thread by psql-mail | last post: by
reply views Thread by konf | last post: by
2 posts views Thread by Fischer Ulrich | last post: by
3 posts views Thread by Marcel Boscher | last post: by
2 posts views Thread by Net Virtual Mailing Lists | last post: by
1 post views Thread by Dawid Kuroczko | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.