Hi all !! Am I right in thinking that Xapian has some nascant interface for sorting or biasing results by a Unix timestamp value stored in a document ? I've been through the documentation but I can't seem to confirm this. I see in a previous email to this list that you can add three terms with the prefixes "D", "M" and "Y" - but I'm not sure if these actually help sort/bias results. Is there a fourth prefix which allows me to store a timestamp ? I've also discovered $enq->set_bias(); but I'm not entirely clear on its options. In some sample code I see set_bias(0, 86400); I guess 86400 is 24 hours in seconds, but what exactly does it do ? Anything you can help me with would be very kind, I'd be happy to update the wiki with any additional "idiots guide" stuff I learn ! best, joss --------------------------------- Now you can scan emails quickly with a reading pane. Get the new Yahoo! Mail.
On Tue, Jul 11, 2006 at 10:20:11AM +0100, Joss Shaw wrote:> Am I right in thinking that Xapian has some nascant interface for > sorting or biasing results by a Unix timestamp value stored in a > document ?For biasing results, yes. The interface for sorting on a value is very usable - I wouldn't describe that as nascent. Rusty Conover is (or was) working on an "ExternalPostList" which is actually very close to what is needed to implement MatchBiasFunctor: http://thread.gmane.org/gmane.comp.search.xapian.devel/741 I don't know what the current status of that is.> I've been through the documentation but I can't seem to > confirm this. I see in a previous email to this list that you can add > three terms with the prefixes "D", "M" and "Y" - but I'm not sure if > these actually help sort/bias results. Is there a fourth prefix which > allows me to store a timestamp ?You want to store the timestamp in a document value, not as a term. Use something like: document.add_value(0, timestamp);> I've also discovered $enq->set_bias(); but I'm not entirely clear on > its options. In some sample code I see set_bias(0, 86400); I guess > 86400 is 24 hours in seconds, but what exactly does it do ?It's the half-life. The extra weight decays exponentially with age, so an article 1 day old will get half the extra weight that a brand new article will; an article 2 days old will get 1/4 of the weight, etc. Cheers, Olly
Thank you very much Olly, that's well useful.
It does leave me a touch unsure of something though..
terms, postings, values.
A term is like a posting but without positional information. You search on terms
and postings.
What therefore is a value - are these searched on in the traditional sense
('keyword foo bar'), or are they used just to narrow a search down -
like a boolean operator might.
thank you v.much,joss
Olly Betts <olly@survex.com> wrote: On Tue, Jul 11, 2006 at 10:20:11AM
+0100, Joss Shaw wrote:> Am I right in thinking that Xapian has some nascant interface for
> sorting or biasing results by a Unix timestamp value stored in a
> document ?
For biasing results, yes. The interface for sorting on a value is
very usable - I wouldn't describe that as nascent.
Rusty Conover is (or was) working on an "ExternalPostList" which is
actually very close to what is needed to implement MatchBiasFunctor:
http://thread.gmane.org/gmane.comp.search.xapian.devel/741
I don't know what the current status of that is.
> I've been through the documentation but I can't seem to
> confirm this. I see in a previous email to this list that you can add
> three terms with the prefixes "D", "M" and
"Y" - but I'm not sure if
> these actually help sort/bias results. Is there a fourth prefix which
> allows me to store a timestamp ?
You want to store the timestamp in a document value, not as a term.
Use something like:
document.add_value(0, timestamp);
> I've also discovered $enq->set_bias(); but I'm not entirely
clear on
> its options. In some sample code I see set_bias(0, 86400); I guess
> 86400 is 24 hours in seconds, but what exactly does it do ?
It's the half-life. The extra weight decays exponentially with age, so
an article 1 day old will get half the extra weight that a brand new
article will; an article 2 days old will get 1/4 of the weight, etc.
Cheers,
Olly
---------------------------------
The all-new Yahoo! Mail goes wherever you go - free your email address from
your Internet provider.