• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Al Hobbs
  • salvin francis

Apache Lucene 3.6.1

Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

Posts: 43027
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic