[Xapian-discuss] More relevance for recent documents

Kevin Duraj kevinduraj at gmail.com
Sat May 28 15:33:23 BST 2011


There is solution to this problem, that I also had to solved on dozens of search engines, I have been working on.

In order to get relevance and recent document factor into account in search result, you must develop your own algorithm that will compute weight values for each document based on the freshness of the document. 

You can also group documents by certain periods and assign them different weight values, so the newer documents will have slightly better weight than older one.

I do something similar at http://find1friend.com

Cheers,
Kevin Duraj

On May 23, 2011, at 4:23 AM, Olly Betts <olly at survex.com> wrote:

> On Mon, May 23, 2011 at 10:55:24AM +0200, Vít??zslav Pl??ek wrote:
>> I would like to ask if is possible somehow give more relevance to the
>> recent documents in search results.
>> I dont want to sort results according to the date, I still prefer
>> relevance, but I would like to see recent documents with better scoring.
>> 
>> I was trying to add search query using AND_MAYBE, which should use
>> relevance from both subqueries, but it didnt add any benefit to the
>> resalts which are match by this subquery
>> 
>> $query = new XapianQuery(XapianQuery::OP_AND_MAYBE, $query, new
>> XapianQuery(XapianQuery::OP_VALUE_GE,  self::DATE, date('Ymd000000',
>> strtotime("- 1 year"))));
> 
> OP_VALUE_GE returns a weight of zero, so sadly that's not going to
> work.  I don't see an easy way around that either.
> 
> If you indexed a term for the week or month the document was in,
> you could do something similar but use an OR of the recent week/month
> terms instead of the value range.
> 
>> Is there some way how to give more relevance to the recent documents?
> 
> If you use a PostingSource, you can do a more sophisticated version
> of what you're strying above and give a variable extra weight so the
> more recent the document, the more the boost:
> 
> http://xapian.org/docs/postingsource
> 
>> Would be solution possible in PHP where is still some problem with
>> subclasing Xapian classes?
> 
> Unfortunately not, since you'd need to subclass PostingSource.
> 
> Cheers,
>    Olly
> 
> _______________________________________________
> Xapian-discuss mailing list
> Xapian-discuss at lists.xapian.org
> http://lists.xapian.org/mailman/listinfo/xapian-discuss



More information about the Xapian-discuss mailing list