Hello I am new to lucene I have created the index using lucene. I am adding two fields filename and contents of the file to lucene index. but when i am searching from index i am able to get the occurrence of a query word and files name those contains the query word. I am not able to view the contents of files for which i have created the index can anybody help please thanks in advance
Directory directory = FSDirectory.open(indexDir);
IndexSearcher searcher = new IndexSearcher(directory,true);
QueryParser parser =
new QueryParser(Version.LUCENE_30,"contents", new SimpleAnalyzer());
Query query = parser.parse(queryStr);
query.setBoost((float)1.5);
TopDocs topDocs = searcher.search(query, maxHits);
ScoreDoc[] hits = topDocs.scoreDocs;
arr= new String[hits.length];
for ( i = 0; i <hits.length; i++) {
int docId = hits[i].doc;
Document d = searcher.doc(docId);
arr[i]=d.get("filename");
}
i am using this code for reading the index.