Lucene.Net will just use text matching, so you need to format the dates correctly before adding to the index:
public static string Serialize(DateTime dateTime)
{
return dateTime.ToString("yyyyMMddHHmmss", CultureInfo.InvariantCulture);
}
public static DateTime Deserialize(string str)
{
return DateTime.ParseExact(str, "yyyyMMddHHmmss", CultureInfo.InvariantCulture);
}
Then you can, for example, run a range-based query to filter by date (for example, from 2006 * to 2007 * to include all dates in 2006 and 2007).
source
share