Hi Lance, thanks for your feedback!
The problem with your suggestion is that we do not want to exclude the fields without a date but boost them differently, which Chris has provided a solution for (see other posts in this thread). Cheers, Robert Norskog, Lance wrote: > This query: field:[* TO *] > Gives the entries which have a value for that field. Documents with nothing > in 'field' will not return. To get the opposite set: > > *:* -field:[* TO *] > > Does this help? > Lance > > -----Original Message----- > From: Robert Krüger [mailto:krue...@signal7.de] > Sent: Saturday, December 13, 2008 4:22 AM > To: solr-user@lucene.apache.org > Subject: Boosting by date when only some records have one > > > Hi, > > I'm looking for a way to boost queries by date but not all documents have a > date associated with them. My goal is to have something like a default boost > for documents (e.g. 1.0) with a function for documents with dates that > distribute the boosts between 1.0 - x to 1.0 + x based on a valid date range. > > So far I have not been able to formulate a query that does that. The query I > tried resulted in documents being returned as results, which without the > boost function, weren't returned, which renders it useless. > > I have criteria in the schema based which I know if that document is supposed > to be boosted by date or not. So in pseudocode what I wanted to have is: > > if(document.dateField != null){ > boost = somefunction(document.dateField); } else{ boost = 1; } > > or (using another field as criterion) > > if(document.hasDateField == 1){ > boost = somefunction(document.dateField); } else{ boost = 1; } > > Any suggestions or sample queries anyone? > > Many thanks in advance, > > Robert > >