The following code illustrates how to use the Lucene highlighter to highlight text in any String.

This code will wrap matching values with a bold tag. Example usage is as follows:

java -cp LuceneHighlighter http://site/index “words”