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 Li Leon <le...@gmail.com> on 2010/01/08 10:42:30 UTC
*Only* the matching whole sentence highlighted
Hi all,
I was able to get a whole sentence(including stop words) highlighted with
"StandardAnalyzer" and an empty stop words String[].
The current issue I'm having is that not only the whole sentence got
highlighted but those tokens partially match with the sentence also
highlighted. I tried to use "PhraseQuery" with the appropriate slop to make
only the intended sentence highlighted, but ended up with exception like
below.
My question is - is this a valid direction to go?
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/lucene/index/memory/MemoryIndex
at
org.apache.lucene.search.highlight.WeightedSpanTermExtractor.getReaderForField(WeightedSpanTermExtractor.java:361)
at
org.apache.lucene.search.highlight.WeightedSpanTermExtractor.extractWeightedSpanTerms(WeightedSpanTermExtractor.java:282)
at
org.apache.lucene.search.highlight.WeightedSpanTermExtractor.extract(WeightedSpanTermExtractor.java:149)
at
org.apache.lucene.search.highlight.WeightedSpanTermExtractor.getWeightedSpanTerms(WeightedSpanTermExtractor.java:414)
at
org.apache.lucene.search.highlight.QueryScorer.initExtractor(QueryScorer.java:216)
at
org.apache.lucene.search.highlight.QueryScorer.init(QueryScorer.java:184)
at
org.apache.lucene.search.highlight.Highlighter.getBestTextFragments(Highlighter.java:226)
at
org.apache.lucene.search.highlight.Highlighter.getBestFragments(Highlighter.java:184)
at
org.apache.lucene.search.highlight.Highlighter.getBestFragments(Highlighter.java:488)
at Hightlight.main(Hightlight.java:161)
Thanks,
Re: *Only* the matching whole sentence highlighted
Posted by Simon Willnauer <si...@googlemail.com>.
You need contrib-memory.jar in your classpath to use MemoryIndex.
simon
On Fri, Jan 8, 2010 at 10:42 AM, Li Leon <le...@gmail.com> wrote:
> Hi all,
>
> I was able to get a whole sentence(including stop words) highlighted with
> "StandardAnalyzer" and an empty stop words String[].
>
> The current issue I'm having is that not only the whole sentence got
> highlighted but those tokens partially match with the sentence also
> highlighted. I tried to use "PhraseQuery" with the appropriate slop to make
> only the intended sentence highlighted, but ended up with exception like
> below.
>
> My question is - is this a valid direction to go?
>
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/lucene/index/memory/MemoryIndex
> at
> org.apache.lucene.search.highlight.WeightedSpanTermExtractor.getReaderForField(WeightedSpanTermExtractor.java:361)
> at
> org.apache.lucene.search.highlight.WeightedSpanTermExtractor.extractWeightedSpanTerms(WeightedSpanTermExtractor.java:282)
> at
> org.apache.lucene.search.highlight.WeightedSpanTermExtractor.extract(WeightedSpanTermExtractor.java:149)
> at
> org.apache.lucene.search.highlight.WeightedSpanTermExtractor.getWeightedSpanTerms(WeightedSpanTermExtractor.java:414)
> at
> org.apache.lucene.search.highlight.QueryScorer.initExtractor(QueryScorer.java:216)
> at
> org.apache.lucene.search.highlight.QueryScorer.init(QueryScorer.java:184)
> at
> org.apache.lucene.search.highlight.Highlighter.getBestTextFragments(Highlighter.java:226)
> at
> org.apache.lucene.search.highlight.Highlighter.getBestFragments(Highlighter.java:184)
> at
> org.apache.lucene.search.highlight.Highlighter.getBestFragments(Highlighter.java:488)
> at Hightlight.main(Hightlight.java:161)
>
>
>
>
> Thanks,
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org