Wednesday, February 2, 2011

How to compile or Run lucene Indexer source code in windows.

1.First extract lucene 1.9.0 src.zip.
2.Then Create class by Jcreator pro.Which is Indexer.java.
3.Save this file to \lucene-1.9-final\src\java folder of lucene.
4.Add these things to import----->

import org.apache.lucene.analysis.standard.*;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.*;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
import java.io.FileReader;
import java.io.IOException;


in .java top.

5.Now run it or compile it so class is create.
6.This is comand based code,so compile it from cmd.
for cmd compilation >>>

1.Go to the disc it contain by
  C:\Documents and Settings\sharma>D:
2. D:\>  cd D:\lucene-1.9-final\src\java         to go to the folder.
3.For Indexing write >>>
D:\lucene-1.9-final\src\java>java Indexer D: C:\ 

D: is the index creator directory And C:\ is the Indexed directory.

Out put is like.>>>
For Searcher.java it will be given in another page or link.