Skip to content

Commit

Permalink
[maven-release-plugin] copy for tag maven-indexer-5.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cstamas committed Nov 20, 2012
2 parents 088f8f3 + f6d076d commit 91147a9
Showing 1 changed file with 8 additions and 3 deletions.
Expand Up @@ -110,6 +110,13 @@ protected DefaultIteratorResultSet( final IteratorSearchRequest request,

this.matchHighlightRequests = request.getMatchHighlightRequests();

List<MatchHighlightRequest> matchHighlightRequests = new ArrayList<MatchHighlightRequest>();
for ( MatchHighlightRequest hr : request.getMatchHighlightRequests() )
{
Query rewrittenQuery = hr.getQuery().rewrite( indexSearcher.getIndexReader() );
matchHighlightRequests.add( new MatchHighlightRequest( hr.getField(), rewrittenQuery, hr.getHighlightMode() ) );
}

this.hits = hits;

this.from = request.getStart();
Expand Down Expand Up @@ -358,8 +365,6 @@ protected List<String> highlightField( IndexingContext context, MatchHighlightRe
text = text.replace( '/', '.' ).replaceAll( "^\\.", "" ).replaceAll( "\n\\.", "\n" );
}

Query rewrittenQuery = hr.getQuery().rewrite( indexSearcher.getIndexReader() );

CachingTokenFilter tokenStream =
new CachingTokenFilter( context.getAnalyzer().tokenStream( field.getKey(), new StringReader( text ) ) );

Expand All @@ -376,7 +381,7 @@ protected List<String> highlightField( IndexingContext context, MatchHighlightRe
+ "\" is not supported!" );
}

return getBestFragments( rewrittenQuery, formatter, tokenStream, text, 3 );
return getBestFragments( hr.getQuery(), formatter, tokenStream, text, 3 );
}

protected final List<String> getBestFragments( Query query, Formatter formatter, TokenStream tokenStream,
Expand Down

0 comments on commit 91147a9

Please sign in to comment.