Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

basic question  RSS feed

 
jonathan ford
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The class url is:
http://lucene.apache.org/java/2_2_0/api/org/apache/lucene/queryParser/QueryParser.html

how can I instantiate a QueryParser instance, supplying the
field name and analyzer to the constructor, and then call the
parse(String query) instance method. I'm a beginner to java, please present the codes, thanks!
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, no. That sure sounds like a school or work assignment, and we don't do people's work for them. Show us how you've tried to do it and failed, and we'll help you get it right.
 
Calum Ludwig
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Jonathan,

As the sheriff has already spoken we can�t show YOU how to go about something, though I�m not sure if that means I cannot tell you.

1.You�ll need to either create your own custom Analyzerclass or use one of the many predefined classes that have already extended the abstract Analyzer class. Remember when creating your own custom Analyzerclass you will need to override the method tokenStream(String fieldName, Reader reader).

2.Then from there you can create the QueryParserobject with the string and newly created Analyzerobject.

Easy peasy lemon squeezy!
[ November 08, 2007: Message edited by: Calum Ludwig ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!