I havent used Compass, but my gut feel is that it may be easier to just integrate Lucene directly. There are good tutorials on this too, google: appfuse + lucene
Easier still would be to stick to SQL/hibernate based queries as Lucene requires an additional module and extra logic in synching up your database and lucene search index. From your search requirements, it looks like it can all be satisifed by SQL. Lucene would be required for more complex and intelligent text based searching. I did something very simple by generating Hibernate Queries on the fly, based on a command object which was simpler but similar in generic nature to your idea. I didnt want to re-invent the wheel but it would have been worse to use a truck's wheel for a small car :) On 20/12/06, Matt Raible <[EMAIL PROTECTED]> wrote:
In addition to eXtremeComponents, you might want to look into using something like Compass (which is a Spring-ish API to Lucene). There's some tutorials on the wiki: Spring MVC: http://www.nabble.com/search---integrate-compass-%28lucene%29-and-appfuse-p5022176s2369.html Struts: http://raibledesigns.com/page/rd?entry=integrating_compass_with_appfuse_and Matt On 12/14/06, Michael Horwitz <[EMAIL PROTECTED]> wrote: > Hi, > > I am not sure if this will fit the bill, but it may just: for my users I > have replaced DisplayTag with the eXtremeComponents table: > http://www.extremecomponents.org/ . It was reasonably easy > to integrate into AppFuse, and includes a search/filter box above each > column. Perhaps not quite as sophisticated as the solution you describe > below, but it gave me happy end users! > > Unfortunately DisplayTag does not (yet) have sort/search functionality by > default. It is, IMHO, the better of the two libraries from a technical > standpoint. > > Mike. > > > On 12/14/06, SkipWalker <[EMAIL PROTECTED]> wrote: > > > > I'm currently using appFuse with webwork + spring + hibernate. > > > > I'm using displaytag to display tables of data for a variety of my > hibernate > > objects. > > > > I'm looking for a best practice or existing library to help me implement a > > search feature for the data I'm displaying in the display tag tables. > > > > Currently, we just do a list of the objects resulting from a simple > > hibernate find. I'd like a way to add a search function so I can display > in > > the table values that match by specified criteria. > > > > For example, I have a hibernate object somewhat like > > > > class Client { > > String id; > > String firstName; > > String lastName; > > Timestamp lastUpdated; > > boolean public; > > } > > > > I'd like to add a search form at the top of the page formatted in such a > way > > that the action that receives the request can easily transform the Request > > parameters into a hibernate Criteria object. > > > > I can see a form something like this > > > > <form name="searchClients" action="searchClients"> > > <!-- some input to indicate what hiberate object to search on, or this > could > > go in the action code --> > > <input type="hidden" name="type" value="Client" /> > > > > First Name: > > <Select name="restriction_firstName"> > > <Option value="like">like</Option> > > <Option value="eq">equals</Option> > > <Option value="gt">greater than</Option> > > <Option value="lt">less than</Option> > > <Option value="in">in</Option> > > <Option value="isNull">is null</Option> > > <Option value="isNotNull">is not null</Option> > > <Option value="startsWith">starts with/Option> > > <Option value="endsWith">starts with/Option> > > </Select> > > <input type="text" name="query_firstName" value="" > > > > > Last Name: > > <Select name="restriction_lastName"> > > <Option value="like">like</Option> > > <Option value="eq">equals</Option> > > <Option value="gt">greater than</Option> > > <Option value="lt">less than</Option> > > <Option value="in">in</Option> > > <Option value="isNull">is null</Option> > > <Option value="isNotNull">is not null</Option> > > <Option value="startsWith">starts with/Option> > > <Option value="endsWith">starts with/Option> > > </Select> > > <input type="text" name="query_lastName" value="" > > > > > ... <!-- dates would probably have some special handling or something --> > > Last Updated > > <Select name="restriction_lastUpdated"> > > <Option value="like">like</Option> > > <Option value="eq">equals</Option> > > <Option value="gt">greater than</Option> > > <Option value="lt">less than</Option> > > <Option value="in">in</Option> > > <Option value="isNull">is null</Option> > > <Option value="isNotNull">is not null</Option> > > <Option value="startsWith">starts with/Option> > > <Option value="endsWith">starts with/Option> > > </Select> > > <input type="text" name="query_lastUpdated" value="" > > > > > </form> > > > > So the input request could look like: > > > > restriction__firstName=eq > > query__firstName=John > > restriction_lastName=like > > query_lastName=Wal > > > > And this would transform into sql: > > > > select * from Clients where firstName = 'John' and lastName like '%Wal%' > > > > The query_ parameter could support or, so a user could input "John or > James" > > > > restriction__firstName=eq > > query__firstName=John or James > > restriction_lastName=like > > query_lastName=Wal > > > > And this would transform into sql: > > > > select * from Clients where (firstName = 'John' or firstName = 'James') > and > > lastName like '%Wal%' > > > > > > The library that the form is submitted to, would then transform these > inputs > > into a hibernate criteria, likely using the hibernate Restrictions class. > I > > can see some sort of method going through each restriction_ and then > getting > > the query_ arg (if it's a binary restriction). > > > > All kinds of things could be added to this: order by, sub queries, etc. > It > > basically requires some standard format for the input, and a library to > > transform the http request parameters in to the hibernate criteria. > > > > So my ultimate question, since I have no desired to reinvent the wheel, is > > does something like this already exist? Does something exists that > > accompolishes basically what I want? > > > > Thanks, > > Skip Walker > > > > > > > > -- > > View this message in context: > http://www.nabble.com/html-search-form-for-hibernate-managed-object-Displaytag-displayed-data---Looking-for-Best-Practices-tf2822969s2369.html#a7879468 > > Sent from the AppFuse - User mailing list archive at Nabble.com. > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > -- http://raibledesigns.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
