This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes Apache Lucene 3.6.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Apache Lucene 3.6.1" Watch "Apache Lucene 3.6.1" New topic
Author

Apache Lucene 3.6.1

Singh Kuldeep
Greenhorn

Joined: Jul 18, 2012
Posts: 19
Hi every body. I want to use apache lucene 3.6.1 api for indexed search. I download jar files, and an example. In that example I am facing the problems described in comments in corresponding line.
Please help where I am going wrong. do i need to download some others jar file besides lucene-core-3.6.1.jar, lucene-core-3.6.1-javadoc.jar, lucene-test-framework-3.6.1.jar, lucene-test-framework-3.6.1.jar

Analyzer analyzer = new StandardAnalyzer();// default constructor is not available
IndexWriter indexWriter = new IndexWriter(INDEX_DIRECTORY, analyzer, recreateIndexIfExists);// recreateIndexifExist is a boolean variable

document.add(new Field(FIELD_PATH, path, Field.Store.YES, Field.Index.UN_TOKENIZED));//Field.Index.UN_TOKENIZED not resolved
Directory directory = FSDirectory.getDirectory(INDEX_DIRECTORY);//getDirectory() not resolved

QueryParser queryParser = new QueryParser(FIELD_CONTENTS, analyzer);//arguments do not match
Hits hits = indexSearcher.search(query);//arguments do not match


Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41124
    
  45
lucene-core-3.6.1.jar is the only file you need for compiling and running.

StandardAnalyzer does not have a no-argument constructor.

Field.Index.UN_TOKENIZED does not exist.

The FSDirectory.getDirectory method takes no parameters.

QueryParser does not have a constructor that takes two parameters.

All this is exactly as stated in the respective javadocs. Are you possibly looking at javadocs for an obsolete version of Lucene? If so, note that Lucene is different from most libraries in that it is *not* backwards-compatible; code written against version X of Lucene frequently needs to be refactored to work with version X+1.


Ping & DNS - my free Android networking tools app
 
 
subject: Apache Lucene 3.6.1
 
Similar Threads
Lucene
Special Characters Lucene
Lucene - The First Parameter of the Index Writer
Lucene beginner question
used lucene?