Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
Improving highlighting
Browse files Browse the repository at this point in the history
git-svn-id: file:///opt/svn/repositories/sonatype.org/nexus/trunk/nexus-indexer@6479 2aa8b3fc-8ebb-4439-a84f-95066eaea8ab
  • Loading branch information
cstamas committed May 19, 2010
1 parent 528d32a commit 05b7399
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Expand Up @@ -13,14 +13,13 @@
import org.apache.lucene.search.highlight.Formatter;
import org.apache.lucene.search.highlight.Highlighter;
import org.apache.lucene.search.highlight.QueryScorer;
import org.apache.lucene.search.highlight.SimpleFragmenter;
import org.apache.lucene.search.highlight.SimpleHTMLFormatter;
import org.sonatype.nexus.index.context.IndexUtils;
import org.sonatype.nexus.index.context.IndexingContext;
import org.sonatype.nexus.index.context.NexusIndexSearcher;

/**
* Default implementation of IteratorResultSet.
* Default implementation of IteratorResultSet. TODO: there is too much of logic, refactor this!
*
* @author cstamas
*/
Expand Down Expand Up @@ -283,7 +282,8 @@ protected String highlightField( IndexingContext context, MatchHighlightRequest

tokenStream.reset();

String rv = highlighter.getBestFragments( tokenStream, text, 1, "..." );
// TODO: this is okay for now, since (see above) we "support" HTML mode only, but later...
String rv = highlighter.getBestFragments( tokenStream, text, 3, "<BR/>" );

return rv.length() == 0 ? null : rv;
}
Expand Down
Expand Up @@ -176,7 +176,6 @@ IndexWriter getIndexWriter()
* creates a new instance of analyzer!
*
* @return
* @deprecated Should not be used directly, since NexusAnalyzer is not thread-safe! Create a new instance if needed.
*/
Analyzer getAnalyzer();

Expand Down
Expand Up @@ -59,6 +59,7 @@ protected boolean isTokenChar( char c )
}
}

@Deprecated
public static class DeprecatedClassnamesTokenizer
extends CharTokenizer
{
Expand Down

0 comments on commit 05b7399

Please sign in to comment.