Hello,

I'm using a MemoryIndex in order to search a block of in-memory text using
a lucene query.
I'm able to search the text, produce a result, and excerpt a highlight
using the highlighter.

Right now I'm doing this:

MemoryIndex index = new MemoryIndex();
index.addField("content", fullText, LuceneAnalyzer);
If(index.search(query) > 0.0f)
{
        Highlighter highlighter = new Highlighter(new QueryScorer(query));
        highlighter.setTextFragmenter(new SimpleFragmenter(150));
        List<String> excerpts =
Arrays.asList(highlighter.getBestFragments(LuceneAnalyzer, "content",
fullText, 5));
        for(String excerpt : excerpts) {
                System.out.println(query.toString() + ": " + excerpt);
        }
}

I'd really like to be able to get the raw TextFragments from the
Highlighter, but I need a TokenStream in order to be able to call
highlighter.getBestTextFragments.
What's the best way to get a tokenstream from a block of text?

Thanks Much!

-Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to