By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,836 Members | 1,703 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,836 IT Pros & Developers. It's quick & easy.

TSearch and rankings

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a


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

P: n/a
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

P: n/a
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

P: n/a


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.