oh, I'm so sorry. you are right, I'm a newcommer! here I explained all things I did!
I want to index some txt files in Lucene, for this means I copied a Index Sourcecode, here is the code: * import* java.io.File; * import* java.io.FileReader; * import* java.io.IOException; * import* *org.apache.lucene.analysis.SimpleAnalyzer*; * import* org.apache.lucene.analysis.standard.StandardAnalyzer; * import* org.apache.lucene.document.Document; * import* org.apache.lucene.document.Field; * import* org.apache.lucene.index.IndexWriter; * import* *org.apache.lucene.store.Directory*; * import* org.apache.lucene.store.FSDirectory; * import* org.apache.lucene.store.RAMDirectory; * import* org.apache.lucene.util.Version; * public* *class* SimpleFileIndexer { *public* *static* *void* main(String[] args) *throws* Exception { File indexDir = *new* File("C:/Users/josh/documents"); File dataDir = *new* File("C:/Users/josh/index"); String suffix = "txt"; SimpleFileIndexer indexer = *new* SimpleFileIndexer(); *int* numIndex = indexer.index(indexDir, dataDir, suffix); System.*out*.println("Total files indexed " + numIndex); } *private* *int* index(File indexDir, File dataDir, String suffix) *throws*Exception { RAMDirectory ramDir = *new* RAMDirectory(); IndexWriter indexWriter = *new* *IndexWriter(ramDir, newStandardAnalyzer(Version. LUCENE_33), true, IndexWriter.MaxFieldLength.UNLIMITED)*; indexWriter.*setUseCompoundFile(false)*; indexDirectory(indexWriter, dataDir, suffix); *int* numIndexed = indexWriter.maxDoc(); indexWriter.optimize(); indexWriter.close(); IndexWriter index = *new* *IndexWriter(FSDirectory.open(indexDir), new StandardAnalyzer(Version.LUCENE_33), false, IndexWriter.MaxFieldLength.UNLIMITED)*; index.*addIndexesNoOptimize(ramDir)*; index.optimize(); index.close(); *return* numIndexed; } *private* *void* indexDirectory(IndexWriter indexWriter, File dataDir, String suffix) *throws* IOException { File[] files = dataDir.listFiles(); *for* (*int* i = 0; i < files.length; i++) { File f = files[i]; *if* (f.isDirectory()) { indexDirectory(indexWriter, f, suffix); } *else* { indexFileWithIndexWriter(indexWriter, f, suffix); } } } *private* *void* indexFileWithIndexWriter(IndexWriter indexWriter, File f, String suffix) *throws* IOException { *if* (f.isHidden() || f.isDirectory() || !f.canRead() || !f.exists()) { *return*; } *if* (suffix!=*null* && !f.getName().endsWith(suffix)) { *return*; } System.*out*.println("Indexing file " + f.getCanonicalPath()); Document doc = *new* Document(); doc.add(*new* Field("contents", *new* FileReader(f))); doc.add(*new* Field("filename", f.getCanonicalPath(), Field.Store.*YES*, Field.Index.*ANALYZED*)); indexWriter.addDocument(doc); } } then I added Lucene-core3.0.2 jar file but some functions and classes have problem! (some parts with line in the code!!) I have never worked with java before and all these are new for me, just I want to run this code. I really need it, please help me and tell me which steps I should do. Thanks alot, and sorry for bad guidence once more. On Mon, Aug 29, 2011 at 3:50 PM, Erick Erickson <erickerick...@gmail.com>wrote: > First, please review: > http://wiki.apache.org/solr/UsingMailingLists > > There is nothing here at all that will allow anyone to > help you with your problem, you have to tell us what > you've done, what you expect, and what actually > happened. > > Best > Erick > > On Mon, Aug 29, 2011 at 1:58 AM, Josh Am <josh22...@gmail.com> wrote: > > Dear friends Hi!! > > I used Lucene to index some documents but unfortunetly I am a begginer > and > > there is a bug!! > > it is here! > > > > what should I do? > > > > thanyou all. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > > For additional commands, e-mail: java-user-h...@lucene.apache.org > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > >