Please find below the Lucene sample code to index the files inside a folder. This code will index ( or create fields for ) the file path, file title, modified date and contents of the file. This java code is expecting the index path ( where the index files will be created ) and file folder path as program arguments like "java IndexFiles [-index INDEX_PATH] [-docs DOCS_PATH]" . The logic of the code is to iterate through each file in the folder and call the method indexDoc(), where the above said fields are created and added to a Document object. This means that for each file there will be a document object and these document objects will be added to IndexWriter. Please find below the screen shot of the indexd file folder : import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Date; import org.apache.lucene.analysis.Analyzer; import org.apa...
To share my ideas and knowledge with you : Java, Spring, ATG, Endeca, Solr, Cassandra, Kafka, Jboss, Eclipse, IntelliJ, Windows, MacOs, Tax tips