Lucene.net multi searcher highlight issue

146 Views Asked by At

I am using lucene.net 2.9.4 (cannot upgrade atm). I am also making use of highlighter.net from lucene.net contrib. I can get it working fine when i am searching on one index my code looks like:

        QueryScorer fragmentScorer = new QueryScorer(query.Rewrite(searcher.GetIndexReader()));

    Highlighter highlighter = new Highlighter(this.HighlightFormatter, fragmentScorer);

    Lucene.Net.Analysis.TokenStream tokenStream = this.HighlightAnalyzer.TokenStream(highlightField, new System.IO.StringReader(value));

    return highlighter.GetBestFragments(tokenStream, value, this.MaxNumHighlights, this.Separator); 

    return highlightField;

The issue is when my searcher object is multisearcher then I do not have the GetIndexReader method.

With multi searcher you are using more than one reader under the hood so kind of makes sense you do not have GetIndexReader.

Is it even possible to highlight with multisearcher? If not then is there a way todo this?

0

There are 0 best solutions below