Nic, You could also accomplish this in a hit collector - reading the value of a stored field and adjusting the score as necessary. We take that approach here for a few searches. If you inherit from TopDocCollector you can modify the score before collecting the hit and it will sort the results for you.
Michael -----Original Message----- From: Nic Wise [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 16, 2008 3:43 AM To: lucene-net-user@incubator.apache.org Subject: RE: Bubbling up "newer" records Thanks! Do you have a URL or some sample code for how to write a custom sort function? I am wanting it to influence the results (as a boost does), not really sort by this one field. Eg, if I start out with a relevance of 0.1 and 0.9, if the 0.1 one was put in today, it may end up being 0.7, and if the 0.9 one was 3 months old, it may be down-graded to 0.72 - so it's not just a pure sort.... I tried a quick google (and will continue once I have this new laptop built up), but couldn't find much. Is there a snippit somewhere? Thanks heaps! -----Original Message----- From: DIGY [mailto:[EMAIL PROTECTED] Sent: 15 January 2008 20:18 To: lucene-net-user@incubator.apache.org Subject: RE: Bubbling up "newer" records Hi Nic, CustomScoreQuery or FieldScoreQuery is introduced with Lucene 2.2. If you don't want to wait for Lucene.Net 2.2, writing a custom sort function and sorting the returned results -for ex.,using the "timestamp" field and the Score() method of Hits class- may be a quick solution. DIGY -----Original Message----- From: Nic Wise [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 15, 2008 7:46 PM To: lucene-net-user@incubator.apache.org Subject: Bubbling up "newer" records Hi there Long time user (and reader), first time poster J Just wondering if anyone knows of a way to bubble up (ie, increase the score on) items which are newer - either via putting a date field in the document, or some kind of timestamp / tick count. I have found some references to doing it in the Java version, but I can't find many of the the classes (FieldScoreQuery, CustomScoreQuery) in the .NET version - I assume they are new in the Java version. I looked into replacing the Query, Weight, Scorer set, modelling it off the Lucene.Net.Search.Spans stuff.... But nothing so far. Am I even looking in the right place? Is it even possible? I'm after something with a long, flat tail (so I guess I'm going to have to write something custom regardless) - eg stuff which is 1 day old gets a boost of 10, 1 week old is 5, 1 month is 2, over three months is 0 etc (with a floating scale on those - think "the long tail" diagram (http://en.wikipedia.org/wiki/The_Long_Tail), but have it hit 0 when it flattens out.) Anyone done this? Thanks heaps. Nic Wise Lead .NET Developer, TopGear.com redevelopment. BBC Worldwide. This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this This e-mail has been sent by one of the following wholly-owned subsidiaries of the BBC: BBC Worldwide, Registration Number: 1420028 England, Registered Address: Woodlands, 80 Wood Lane, London W12 0TT BBC World, Registration Number: 04514407 England, Registered Address: Woodlands, 80 Wood Lane, London W12 0TT BBC World Distribution Limited, Registration Number: 04514408, Registered Address: Woodlands, 80 Wood Lane, London W12 0TT This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system. Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this This e-mail has been sent by one of the following wholly-owned subsidiaries of the BBC: BBC Worldwide, Registration Number: 1420028 England, Registered Address: Woodlands, 80 Wood Lane, London W12 0TT BBC World, Registration Number: 04514407 England, Registered Address: Woodlands, 80 Wood Lane, London W12 0TT BBC World Distribution Limited, Registration Number: 04514408, Registered Address: Woodlands, 80 Wood Lane, London W12 0TT