This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Apache Lucene 3.6.1  RSS feed

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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


 
Rancher
Posts: 42974
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Talk sense to a fool and he calls you foolish. -Euripides A foolish tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!