469,087 Members | 1,275 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,087 developers. It's quick & easy.

TSearch and rankings

Hi,

Is there a way to use tsearch so that it returns documents that have less
than all the required keywords? The idea is that if a document only has 3
out of 4 terms, it is still returned, but with a lower ranking.

So far I haven't found a way to do this in the documentation. Is there
something like a "maybe" operator? (ie: 'foo&bar&~doh', meaning documents
with foo and bar, and optionaly doh, but those with would be ranked
higher)

Cheers,
Bas.

---------------------------(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 22 '05 #1
4 1721


Bas Scheffers wrote:
Hi,

Is there a way to use tsearch so that it returns documents that have less
than all the required keywords? The idea is that if a document only has 3
out of 4 terms, it is still returned, but with a lower ranking.

So far I haven't found a way to do this in the documentation. Is there
something like a "maybe" operator? (ie: 'foo&bar&~doh', meaning documents
with foo and bar, and optionaly doh, but those with would be ranked
higher)


(foo&bar)|(foo&bar&doh)

I think, it's what you want.
--
Teodor Sigaev E-mail: te****@sigaev.ru

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 22 '05 #2
Teodor Sigaev said:
(foo&bar)|(foo&bar&doh)
I think, it's what you want.

That simple huh? Can become a bit complicated, doing an OR for all the
different combinations, but a quick test I just did did show a higher
ranking for the documents that matched the larger query. And quite usable
in my application.

Do big queries have a significant inpact on search performance? (this is
something that is important!)

Thanks,
Bas.
---------------------------(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 22 '05 #3
On Mon, 9 Feb 2004, Bas Scheffers wrote:
Teodor Sigaev said:
(foo&bar)|(foo&bar&doh)
I think, it's what you want. That simple huh? Can become a bit complicated, doing an OR for all the
different combinations, but a quick test I just did did show a higher
ranking for the documents that matched the larger query. And quite usable
in my application.

Do big queries have a significant inpact on search performance? (this is
something that is important!)


Sure :( In degenerated case you end with query like (word1|word2|word3|..|wordN)
and it's equivalent running N searches with single word query, which isn't
effective. Intrinsically, tsearch2 is much faster for long AND queries,
which is opposite to standard search engines based on inverted indexes.

Thanks,
Bas.
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)


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

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 22 '05 #4


Oleg Bartunov wrote:
On Mon, 9 Feb 2004, Bas Scheffers wrote:

Teodor Sigaev said:
(foo&bar)|(foo&bar&doh)
I think, it's what you want.


That simple huh? Can become a bit complicated, doing an OR for all the
different combinations, but a quick test I just did did show a higher
ranking for the documents that matched the larger query. And quite usable
in my application.

Do big queries have a significant inpact on search performance? (this is
something that is important!)

Sure :( In degenerated case you end with query like (word1|word2|word3|..|wordN)
and it's equivalent running N searches with single word query, which isn't
effective. Intrinsically, tsearch2 is much faster for long AND queries,
which is opposite to standard search engines based on inverted indexes.


Ugh. The performance for complex query such as
(foo&bar)|(foo&bar&doh)|(foo&bar&doh&other)
will be equals to simple query foo&bar, because other variants is a stronger
that simplest variant. Performance is defined by number of page readed (we
suppose that CPU is much faster than disks) and if more ANDed words in query
than smaller number of readed pages.


--
Teodor Sigaev E-mail: te****@sigaev.ru

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 22 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Amir Michail | last post: by
reply views Thread by Joerg Erdmenger | last post: by
3 posts views Thread by Joerg Erdmenger | last post: by
13 posts views Thread by Nigel J. Andrews | last post: by
1 post views Thread by sector119 | last post: by
2 posts views Thread by Rajesh Kumar Mallah | last post: by
1 post views Thread by linbl352 | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.