lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: Highlighter for 1.4.3?
Date Mon, 31 Oct 2005 07:57:21 GMT

On 31 Oct 2005, at 01:07, J Jensen wrote:
> I got the LuceneInAction.zip, extracted the highlighter-dev.jar and  
> added it to the my classpath.  I tried to Test the jar with this  
> code from the LIA...

> String string = "The quick brown fox jumps over the lazy dog";
> TermQuery termQuery = new TermQuery(new Term("field", "fox"));
> QueryScorer scorer = new QueryScorer(termQuery);
> Highlighter highlighter = new Highlighter(scorer);
> TokenStream tStream = new StandardAnalyzer().tokenStream("field",  
> new StringReader(string));
> String s = highlighter.getBestFragment(tStream, string);
> System.out.println(s);
>
> and I get this error...
>
> Exception in thread "main" java.lang.NoSuchMethodError:  
> org.apache.lucene.search.highlight.TextFragment.<init>(II)V
> at  
> org.apache.lucene.search.highlight.Highlighter.getBestDocFragments 
> (Highlighter.java:138)
> at org.apache.lucene.search.highlight.Highlighter.getBestFragments 
> (Highlighter.java:101)
> at org.apache.lucene.search.highlight.Highlighter.getBestFragment 
> (Highlighter.java:73)
>
> Am I using the correct jar?  After looking into the src files, I  
> want to say that the TextFragment constructor (from the jar file)  
> take only 2 params, but the Highlighter or TokenSources is trying  
> to pass it 3 params, but I am not sure of any of this?  Can you  
> make sense of this?

My hunch is you've got another Highlighter JAR in your classpath.   
The LIA code compiles just fine against the highlighter-dev.jar it  
contains, so I can only presume you've got something mismatched.

     Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message