Using the Lucene Query Parser Without Luceneby Marcin Maciukiewicz, Daniel Owsiański
Lucene is a search engine project developed under the Apache Foundation. This project is well known as one of the best solutions when you need search capability in your application. There are plenty of legacy applications where the existing database solution cannot be replaced with Lucene, but they require support for user-friendly searching.
As the application grows more complex, the design of the search tool becomes crucial. The most common design approach is a search based on forms. Users are given a set of fields to express search criteria. One of the most common examples is Google's advanced search page, shown in Figure 1.
Figure 1. Google advanced search
But we all know this is not what Google is famous for. The "single search field" is the recognizable Google brand. Even though it is a simple interface, it has plenty of power, and most people aren't even aware there is a real query structure behind it. Entering specific phrases gives you a chance to express a whole range of restrictions as if you were using an advanced search form. Lucene has almost the same kind of search capabilities.
Stop creating sophisticated search forms. You can use technologies like Ajax to give you the power of creating user friendly interfaces; use ideas like "suggest" or "type ahead"; and create a simpler interface so your users won't feel lost in a huge set of search options. Remember, all users want is to quickly find the information they are looking for. You may stop creating sophisticated and hard-to-maintain search forms, instead providing searches based on Lucene query syntax. You could satisfy your users with a simple search field, as Google does (see Figure 2).
Figure 2. Google simple search
At the end of this article you will realize how easy it is.