This discussion is archived
1 Reply Latest reply: Nov 22, 2010 8:39 AM by jschellSomeoneStoleMyAlias RSS

ask for a design pattern

800928 Newbie
Currently Being Moderated
Note: THis is a cross post at stackover .

Got no answer ,so post it here. :)

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:



This is used to limit the search scope(just search within the special category).


These two parameters are using for paging.


The returnFields which will be retivived from the index(if it is Stored in the index) and return to the client.

So I have no idea about how to build the query using the estimate syntax(if....else....if...).

Anyone can tell me how ?
  • 1. Re: ask for a design pattern
    jschellSomeoneStoleMyAlias Expert
    Currently Being Moderated
    using the estimate syntax
    No idea what that means.

    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


  • Correct Answers - 10 points
  • Helpful Answers - 5 points