@@ -0,0 +1,1882 @@
+package com.lucene;%0A%0Aimport java.io.File;%0Aimport java.io.FileFilter;%0Aimport java.io.IOException;%0Aimport java.util.ArrayList;%0A%0Aimport jxl.read.biff.BiffException;%0A%0Aimport org.apache.lucene.analysis.fa.PersianAnalyzer;%0Aimport org.apache.lucene.document.Document;%0Aimport org.apache.lucene.index.CorruptIndexException;%0Aimport org.apache.lucene.index.IndexWriter;%0Aimport org.apache.lucene.index.IndexWriterConfig;%0Aimport org.apache.lucene.store.Directory;%0Aimport org.apache.lucene.store.FSDirectory;%0Aimport org.apache.lucene.util.Version;%0A%0Apublic class Indexer %7B%0A%0A%09private IndexWriter writer;%0A%0A%09public Indexer(String indexDirectoryPath) throws IOException %7B%0A%0A%09%09Directory indexDirectory = FSDirectory.open(new File(indexDirectoryPath));%0A%0A%09%09PersianAnalyzer persianAnalyzer = new PersianAnalyzer(Version.LUCENE_36);%0A%09%09IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_36, persianAnalyzer);%0A%0A%09%09writer = new IndexWriter(indexDirectory, conf);%0A%09%7D%0A%0A%09public void close() throws CorruptIndexException, IOException %7B%0A%0A%09%09writer.close();%0A%09%7D%0A%0A%09public void createIndex(String indexPath, String corePath,String labelPath, String categoryPath, String commentPath) %7B%0A%09%09%0A%09%09%0A%09%7D%0A%09%0A%09private ArrayList %3CDocument%3E getDocuments(File file) throws IOException, BiffException%7B%0A%0A%09%09ArrayList %3CDocument%3E documentsArray = new ArrayList %3CDocument%3E();%0A%0A%09%09CoreNews coreNews = new CoreNews();%0A%09%09documentsArray = coreNews.GenerateNewsData(file);%0A%0A%09%09return documentsArray;%0A%09%7D%0A%0A%09private void indexFile(File file) throws IOException, BiffException %7B%0A%0A%09%09writer.addDocuments(getDocuments(file));%0A%09%7D%0A%0A%09public int createIndex(String dataDirPath, FileFilter filter) throws IOException, BiffException%7B%0A%0A%09%09File file = new File(LuceneConstants.FILE_PATH_CORENEWS);%0A%0A%09%09if(!file.isDirectory() && !file.isHidden() && file.exists() && file.canRead() && filter.accept(file))%0A%09%09%09indexFile(file);%0A%0A%09%09return writer.numDocs();%0A%09%7D%0A%7D

Create Indexer Class In Order to Indexing Data