lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Botin <>
Subject Problem using highlighter package
Date Tue, 17 Feb 2004 22:16:30 GMT
Hi there !
I downloaded the highlighter package made available by Mark Hardwood on :
I followed the instructions given on this site to use the package, but when I try to run my
application, I get the following message :
" Method rewrite(org.apache.lucene.index.IndexReader)
not found in class = query.rewrite(reader); "
Then, if I remove the instruction "query = query.rewrite(reader);", I get another NoSuchMethodError
(A piece of my source code is at the end of this message)
Does anybody have a clue to solve my problem ?
And by the way, can somebody explain me what the query.rewrite() function is used for exactly

I thank you all in advance.
 import org.apache.lucene.index.*;
 IndexReader reader =;
 searcher = new IndexSearcher( reader );
 Analyzer analyzer = new FrenchAnalyzer();
 query = QueryParser.parse(queryString, "contents", analyzer);
 query = query.rewrite(reader);
 QueryHighlightExtractor highlighter = 
    new QueryHighlightExtractor(query, new FrenchAnalyzer(),
       "<font style=\"background:yellow;\">", "</font>");
 int highlightFragmentSizeInBytes = 80;
 int maxNumFragmentsRequired = 4;
 String fragmentSeparator="...";
 String highlightedSummary =
   highlighter.getBestFragments(summary, highlightFragmentSizeInBytes,
      maxNumFragmentsRequired, fragmentSeparator);
For information, I added
to my classpath.

Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
Créez votre Yahoo! Mail
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message