Wizard API updated!
Tim Boudreau has released a new version of the Swing Wizard library (version 0.997) that fixes the WizardException bug reported in JavaWorld's recent Open Source Java Project profile. The article's examples have been reworked to test out the new, improved WizardException. Thanks, Tim, for this helpful fix!
Open Source Java Projects: The Wizard API

Newsletter sign-up

Sign up for our technology specific newsletters.

Enterprise Java
View all newsletters

Email Address:

Build application search features modeled on Web searches

A framework for building Web search-like features in applications

Most applications include some form of search functionality, and often, application navigation begins with the execution of a search query. Users then navigate around the application after establishing a context by selecting a particular item from the search results. An application's usability vastly improves if searching is enabled from different navigational depths.

To make the searching feature ubiquitous in an application, the user interface components must be kept simple and lightweight, thereby making the search dialog easily portable across the application. Many applications provide query options based on specific attributes or a combination thereof. But in this scenario, users are constrained in their queries by the limited set of attributes presented to them on the search page. Plus, the addition of new attributes to a page makes searching less intuitive and, in some cases, clutters the search page. An example of a simple but extremely effective search UI can be found in Web searching. Extending such a concept to application searches is only logical and practical, and is the topic of this article's discussion.

This article presents a framework that can be used to develop search features modeled on Web searches. The framework simplifies the client code and is easily extensible in that implementations can extend the framework to provide various application-specific search features. A single application can contain several different implementations of this framework, each corresponding to a search by different business objects.

Goals behind the design

The framework enables the building of search functionality that accepts an arbitrary query string. The string could contain words and/or phrases corresponding to attributes of a business object. The client interface to a search implementation in its simplest form takes in a query string and returns a java.util.Collection of some arbitrary key objects as in the following method signature:

 public Collection getKeys(String searchStr); 


The key objects in the result set uniquely identify the business objects returned from the search execution and can then be used to retrieve other details of the business objects.

Search functionality in most applications allows only searching a business object by a few attributes. In database applications, this means only a few columns of a given table are used in query predicates, and often, for performance reasons, the table is indexed on these columns. The mechanism used to execute the search could vary from having separate queries for each attribute to building a complex query at runtime that includes all the predicates. Regardless of the querying functionality's mechanics, the fact remains that an attribute and a search string are matched at design time by mapping user interface fields to attributes.

In the proposed scheme, however, by providing a single string interface, the association between the search string and the search object's attribute has been eliminated. This begs the question: What attribute do I search against? One possible solution for overcoming this lost association is for the search string to query all the attributes with the expectation that one or more queries would return a result set. This would entail executing all the queries all the time.

1 | 2 | 3 | 4 |  Next >

Discuss

Start a new discussion or jump into one of the threads below:

Subject Replies Last post
. lucene anyone?
By Anonymous
5 05/16/08 06:28 AM
by Anonymous
. Red Piranha (Lucene Based)
By Paul Browne
0 07/23/07 06:01 AM
by Anonymous
. Lucene Perfomance
By ramesh_n
1 03/02/06 11:53 AM
by ramesh_n
. Usefull
By Mad
0 03/29/05 04:44 AM
by Anonymous
. Build application search features modeled on Web s
By JavaWorldAdministrator
0 03/27/05 11:51 PM
by JavaWorld


Resources