lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Seltzer <dselt...@tveyes.com>
Subject Working with MemoryIndex results
Date Wed, 08 Feb 2012 21:36:44 GMT
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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message