lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smiley <david.w.smi...@gmail.com>
Subject Re: highlighter with query over more than one word
Date Sat, 04 Jun 2016 01:23:55 GMT
It would help tremendously if you can give a specific code example showing
the problem.

On Thu, Jun 2, 2016 at 6:41 AM Sascha Janz <Sascha.Janz@gmx.net> wrote:

>
> 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
>
> --
Lucene/Solr Search Committer, Consultant, Developer, Author, Speaker
LinkedIn: http://linkedin.com/in/davidwsmiley | Book:
http://www.solrenterprisesearchserver.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message