We are working on web application with a search model.
In the search servlet it capture the request parameters from the client, and then build a hibernate-search query for searching.
Now the problem is the parameters from the clien are mutable!.
All the parameters we accepts are listed as following:
The keyword(s) using for searching,a search request can be processed even just this parameter is passed. Valid example:
These four parameter must occur at the same time or never.Since these four paramers are used for a TermRangeQuery in lucene.If one of them occur,the rest three must be occur also. And,these four parameter can occur with the "keyword" at the sametime. Valid example:
But the steps are.
1. Parse parameters.
2. Validate parameters. I would use one method for each step you outlined. Validation must include some way to determine which step failed. For example an exception that says "keyword must have a non-empty value"
3. Build hibernate query