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: 
One way to avoid incorrect dates in User input, is not to let them happen in the first instance, i.e. use a date picker control.

What about using [`DateTime.TryParse`](http://msdn.microsoft.com/en-us/library/system.datetime.tryparse.aspx) ?

> 
> Converts the specified string
>  representation of a date and time to
>  its DateTime equivalent using the
>  specified culture-specific format
>  information and formatting style, and
>  returns a value that indicates whether
>  the conversion succeeded.
> 
> 
> 

This [MSDN page](http://msdn.microsoft.com/en-us/library/9h21f14e.aspx) shows examples of usage.
The compiler will just throw a cannot parse exception, so you'll have to write your own parser for this kind of problems.