BooleanQuery is used to search documents which are a result of multiple queries using AND, OR or NOT operators.
Following is the declaration for the org.apache.lucene.search.BooleanQuery class −
Following is the field for the BooleanQuery −
The following table shows the different class constructors −
|S.No.||Constructor & Description|
The following table shows the different class methods −
|S.No.||Method & Description|
This class inherits methods from the following classes −
Let us create a test Lucene application to test search using BooleanQuery.
This class is used to provide various constants to be used across the sample application.
This class is used to read the indexes made on raw data and searches data using the Lucene library.
This class is used to test the searching capability of the Lucene library.
We have used 10 text files from record1.txt to record10.txt containing names and other details of the students and put them in the directory E:\Lucene\Data. Test Data. An index directory path should be created as E:\Lucene\Index. After running the indexing program during chapter Lucene - Indexing Process, you can see the list of index files created in that folder.
Once you are done with the creation of the source, the raw data, the data directory, the index directory and the indexes, you can proceed by compiling and running your program. To do this, keep the LuceneTester.Java file tab active and use either the Run option available in the Eclipse IDE or use Ctrl + F11 to compile and run your LuceneTester application. If everything is fine with your application, this will print the following message in Eclipse IDE's console −
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 © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.