[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lucene-user
Subject:    Re: Using the highlighter from the sandbox with a prefix query.
From:       Erik Hatcher <erik () ehatchersolutions ! com>
Date:       2005-02-21 16:54:57
Message-ID: 80b8ff5d8cc6b3e95dd171f1baed3b3b () ehatchersolutions ! com
[Download RAW message or body]


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 lucenebook.com 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\">",
                 "</span>");
         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(hits.id(position));

Hope this helps.

	Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic