Question: I'd like to implement a filter/search feature in my application using Lucene. 

Querying Lucene index gives me a `Hits` instance, which is nothing more than a list of `Document`s matching my criteria. 

Since I generate the indexed `Document`s from my objects, which is the best way to find the original object related to a specific Lucene `Document`?

---

A better description of my situation: 

* Three model classes for now: `Folder` (can have other `Folder`s or
`List`s as children), `List` (can have `Task`s as children) and
`Task` (can have other `Task`s as children). They are all
`DefaultMutableTreeNode` subclasses. I'll add the `Tag` entity in the
future.
* Each `Task` has a text, a start date, a due date, some boolean flags.
* They are displayed in a `JTree`.
* The hole tree is saved in an XML file.
* I'd like to do things like these:
* search `Task`s with Google-like queries.
* Find all `Task`s that start today.
* Filter `Task`s by `Tag`.

Answer: 
I think the `DateTime.DaysInMonth` method can help a lot, after a `TryParse` ... you can implement the logic you are talking about
Rule #1: As reasonably as possible, don't allow a user to input invalid data in the first place.

If you're doing Windows Forms, use the DateTimePicker as much as possible (although it has its limitations when it comes to locale); or, if your app is in ASP.NET, use a Calendar, or one of the AJAX Control Toolkit controls (I forget the exact name right now), but it does a little popup with a calendar.

I would strongly advise against separating out the date components into different fields (or parsing them as such) if there is ANY chance of needing to localize this application later.