Create your own search engine!
Is there anyone who uses Internet but not Google?? For searching any thing on the web, the first site that comes to our mind is Google. Ever thought to have your own search engine?? Not like the Google but a simple one that runs in your desktop and searches your files. Or what if you need to add search functionality to your website?
<a href="https://lucene.apache.org/" target="_blank" rel="nofollow noopener noreferrer">Apache Lucene - Welcome to Apache Lucene</a> is there to serve your needs. Lucene is an extremely rich and powerful full-text search API written in Java.
In this post, I will briefly explain how Lucene Directory works.
The first step in implementing full-text searching with Lucene is to build an index. This is easy - you just specify a directory and an analyzer class. The analyzer breaks text fields into indexable tokens; this is a core part of Lucene.
Several types of analyzers are provided out of the box. Below listed some of the more interesting ones.
Lucene analyzersStandardAnalyzer: A sophisticated general-purpose analyzer.
WhitespaceAnalyzer: A very simple analyzer that just separates tokens using white space.
StopAnalyzer: Removes common English words that are not usually useful for indexing.
SnowballAnalyzer: An interesting experimental analyzer that works on word roots (a search on rain should also return entries with raining, rained, and so on).
There are even a number of language-specific analyzers, including analyzers for German, Russian, French, Dutch, and others.