The procedure of searching is one of the core functionalities provide by Lucerne. Following figure illustrates the process and its use. Index Searcher is one of the middle works of the searching process.
we initial generate Directory(s) containing indexes and then exceed it to Index Searcher which open the Directory using Index Reader. Then we make a Query with a Term and make a search using Index Searcher by passing the Query to the searcher. Index Searcher returns a To-dos entity which contains the search information along with essay ID(s) of the file which is the result of the search process.
We will now explain you a step-wise move towards and help you recognize the indexing process using an essential instance.
Query Parser category parses the user enter input into Lucerne clear format query. Follow these steps to build a Query Parser −
Step 1 − construct object of Query Parser.
Step 2 − Initialize the Query Parser object created with a pattern analyzer having version information and index name on which this query is to be run.
Index Searcher class acts as a middle constituent which searcher indexes formed during indexing process. Follow these steps to create an Index Searcher −
Step 1 − Create object of Index Searcher.
Step 2 − Create a Lucerne directory which should point to position where indexes are to be store.
Step 3 − Initialize the Index Searcher object produced with the index directory.
Follow these steps to construct search −
Step 1 − generate a Query object by parsing the search phrase through Query Parser.
Step 2 − Make search by calling the IndexSearcher.search () method.
The following program shows how to get the manuscript.
The following program shows how to secure the Index Searcher.
Let us form a test Lucerne application to test searching development.
This class is used to offer different constants to be used diagonally the sample application.
This class is used as a .txt file filter.
This division is used to read the indexes made on raw data and searches data use the Lucerne annals.
This division is usedto test the searching ability of the Lucerne library.
We have use 10 text files named record1.txt to record10.txt contain names and other information of the students and put them in the directory E:\Lucene\Data. Test Data. An index directory course should be formed as E:\Lucene\Index. After running the indexing program in the section Lucerne - Indexing Process, you can observe the list of index files produced in that database.
Formerly you are done with the design of the source, the raw data, the data directory, the index directory and the indexes, you can continue by compile and running your program. To do this, maintain LuceneTester.Java file tab dynamic and use each the Run option accessible in the Eclipse IDE or use Ctrl + F11 to assemble and run your LuceneTesterapplication. If your application runs effectively, it will print the following communication in Eclipse IDE's comfort –
Lucene Related Interview Questions
|Core Java Interview Questions||MySQL Interview Questions|
|JSP Interview Questions||Hadoop Interview Questions|
|Quark Xpress Interview Questions||Hibernate Interview Questions|
|Sqoop Interview Questions||Apache Solr Interview Questions|
|HBase Interview Questions||MongoDB Interview Questions|
|Spring MVC Framework Interview Questions||Hadoop Testing Interview Questions|
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.