Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Adding search to your applications

The Lucene search engine is an open source, Jakarta project used to build and search indexes. Lucene can index any text-based information you like and then find it later based on various search criteria.

Tutorial Details:

Although Lucene only works with text, there are other add-ons to Lucene that allow you to index Word documents, PDF files, XML, or HTML pages. Lucene has a very flexible and powerful search capability that uses fuzzy logic to locate indexed items. Lucene is not overly complex. It provides a basic framework that you can use to build full-featured search into your web sites.

The easiest way to learn Lucene is to look at an example of using it. Let's pretend that we are writing an application for our university's Physics department. The professors have been writing articles and storing them online and we would like to make the articles searchable. (To make the example simple, we will assume that the articles are stored in text format.) Although we could use google, we would like to make the articles searchable by various criteria such as who wrote the article, what branch of physics the article deals with, etc. Google could index the articles but we wouldn't be able to show results based on questions such as, "show me all the articles by Professor Henry that deal with relativity and have superstring in their title."

What's inside?
Let's take a look at the key classes that we will use to build a search engine.

Document - The Document class represents a document in Lucene. We index Document objects and get Document objects back when we do a search.
Field - The Field class represents a section of a Document. The Field object will contain a name for the section and the actual data.
Analyzer - The Analyzer class is an abstract class that used to provide an interface that will take a Document and turn it into tokens that can be indexed. There are several useful implementations of this class but the most commonly used is the StandardAnalyzer class.
IndexWriter - The IndexWriter class is used to create and maintain indexes.
IndexSearcher - The IndexSearcher class is used to search through an index.
QueryParser - The QueryParser class is used to build a parser that can search through an index.
Query - The Query class is an abstract class that contains the search criteria created by the QueryParser.
Hits - The Hits class contains the Document objects that are returned by running the Query object against the index.



 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Adding search to your applications

View Tutorial:
Adding search to your applications

Related Tutorials:

Add a file finder accessory to JFileChooser - JavaWorld
Add a file finder accessory to JFileChooser - JavaWorld
 
The Lucene search engine: Powerful, flexible, and free - JavaWorld September 2000
The Lucene search engine: Powerful, flexible, and free - JavaWorld September 2000
 
Plant your data in a ternary search tree - JavaWorld February 2001
Plant your data in a ternary search tree - JavaWorld February 2001
 
Big designs for small devices
Big designs for small devices
 
Add concurrent processing with message-driven beans
Add concurrent processing with message-driven beans
 
Once again, only introduction
Once again, only introduction
 
Koalog Constraint Solver v2.2 released
Koalog Constraint Solver v2.2 released What is Koalog Constraint SolverTM? Koalog Constraint SolverTM is a powerful JavaTM library for solving combinatorial optimization problems using Constraint Programming or Local Search. It provides cutting-edge te
 
JavaMatch
What is JavaMatch? JavaMatch is an engine that can search inside a runtime Java data structures, and look for objects that best match the criteria that you specify. JavaMatch is a generic match engine, not targeted at a specific domain. It can be applied
 
Can't beat Jazzy
Introducing the Java platform's Jazzy new spell checker API.
 
Develop aspect-oriented Java applications with Eclipse and AJDT
AspectJ is an aspect-oriented extension of the Javaâ„¢ language that enables a modular implementation of crosscutting concerns. This crosscutting behavior, which can be static or dynamic, presents an extra challenge to tools that support AspectJ. The AJDT
 
Lucene in Action
Lucene in Action Lucene is a gem in the open-source world--a highly scalable, fast search engine. It delivers performance and is disarmingly easy to use. Lucene in Action is the authoritative guide to Lucene. It describes how to index your data, includin
 
Unweaving a Tangled Web With HTMLParser and Lucene
In this article I'll show you the basic technique in building a search engine using two powerful Open Source products: HTMLParser and Lucene.
 
Adding search to your applications
The Lucene search engine is an open source, Jakarta project used to build and search indexes. Lucene can index any text-based information you like and then find it later based on various search criteria.
 
Java Technology Fundamentals
Learn how to use variable arguments lists, the new JConsole utility to monitor applications, and discover ways to learn what you need to know to get Sun certified.
 

Windows Search Windows Hosting Plans
 
Adding slash "\" character before quote "'" in a query
Adding slash "\" character before quote "'" in a query Adding slash " \ " character before quote " ' " in a query During the inserting the records in the database if user enters the phrases like "What ' s your name?", database gives the error due
 
Download Search Engine Code its free and Search engine is developed in Servlets
Download Search Engine Code its free and Search engine is developed in Servlets Download Search Engine Code Installation Instruction Download and unzip the file into your favorite directory. Create a database on your MySQL Server. Run all the
 
Building Search Engine Applications Using Servlets !
Building Search Engine Applications Using Servlets ! Building Search Engine Applications Using Servlets Please visit http://www.webappcabaret.com/javadevelopers/search to see running copy of our search engine. Introduction This tutorial takes
 
Welcome to Free search engine secrets: webmaster's guide to search engine registration!
Welcome to Free search engine secrets: webmaster's guide to search engine registration! Welcome To Webmaster's Guide T his site is dedicated to Web related services. Here you can find tools and suggestions to promote your sites to several search
 
Manual Submission to Search Engines. Hand Submit Website URL Submission to Major Search Engines
Manual Submission to Search Engines. Hand Submit Website URL Submission to Major Search Engines ATTENTION: Website owners! Hand Submissions to major search engines for as low as $10.00 per month Let us introduce you to the services provided by
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.