You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by J Jensen <je...@ohsu.edu> on 2005/10/31 07:07:38 UTC
Highlighter for 1.4.3?
Erik,
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?
Thanks again,
Jeff
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Highlighter for 1.4.3?
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
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