lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sascha Janz" <Sascha.J...@gmx.net>
Subject highlighter with query over more than one word
Date Thu, 02 Jun 2016 10:41:05 GMT

we use highlighter to get textfragments for our hit list.
 
the code is straight forward like this

   Analyzer analyzer = new StandardAnalyzer(;
   QueryParser parser = new QueryParser( "content", analyzer);
   Highlighter highlighter = new Highlighter(new QueryScorer(parser.parse(pQuery)));
   Fragmenter fragmenter = new SimpleFragmenter(fragmentsize);
   highlighter.setTextFragmenter(fragmenter);
   TokenStream stream = analyzer.tokenStream("content", new StringReader(value));
   String text = highlighter.getBestFragments(stream , value, 3);

in most cases this gives us good results.

but sometime when we do a query over multiple words. we get only highlighted fragments for
one word.

e.g. a query with "aalen ringen" does only become highlighted fragments with "ringen", although
the word "aalen" is also in the content. 

any tips for getting better results?

regards
Sascha




---------------------------------------------------------------------
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