Now that you have indexed your data, you will be searching the data using Apache Lucene in this recipe. The code for searching in this recipe depends on the index that you created in the previous recipe, and therefore, it will only successfully execute if you followed the instructions in the previous recipe.
Complete the previous recipe. After completing the previous recipe, go to the index directory in your project that you created in step 11 of that recipe. Make sure that you see some indexing files there:
Create a Java file named
SearchFiles
in theorg.apache.lucene.demo
package you created in the previous recipe:Now you are ready to type in some code in the
SearchFiles.java
file.