lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <>
Subject Re: Using the highlighter from the sandbox with a prefix query.
Date Mon, 21 Feb 2005 16:54:57 GMT

On Feb 21, 2005, at 10:53 AM, Michael Celona wrote:

> That the only stack I get.  One thing to mention that I am using a
> MultiSearcher to rewrite the queries. I tried...
> query = searcher_last.rewrite( query );
> query = searcher_cur.rewrite( query );
> using IndexSearcher and I don't get an error... However, I not able to
> highlight wildcard queries.

I use Highlighter for and have two indexes that I search 
with MultiSearcher.  Here's how I highlight:

         IndexReader reader = readers[indexIndex];
         QueryScorer scorer = new QueryScorer(query.rewrite(reader));
         SimpleHTMLFormatter formatter =
             new SimpleHTMLFormatter("<span class=\"highlight\">",
         Highlighter highlighter = new Highlighter(formatter, scorer);

I get the appropriate IndexReader for the document being highlighted.  
You can get the index _index_ this way:
         int indexIndex = searcher.subSearcher(;

Hope this helps.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message