lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Seltzer <>
Subject Working with MemoryIndex results
Date Wed, 08 Feb 2012 21:36:44 GMT

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( > 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
What's the best way to get a tokenstream from a block of text?

Thanks Much!


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

View raw message