lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vempap <>
Subject Token Stream with Offsets (Token Sources class)
Date Sun, 07 Apr 2013 23:16:48 GMT

  I've the following snippet code where I'm trying to extract weighted span
terms from the query (I do have term vectors enabled on the fields):

		File path = new File(
		FSDirectory directory =;
		IndexReader indexReader =;

		Map<String, WeightedSpanTerm> allWeightedSpanTerms = new HashMap<String,

		WeightedSpanTermExtractor extractor = null;
		extractor = new WeightedSpanTermExtractor();
		TokenStream tokenStream = null;
		tokenStream = TokenSources.getTokenStreamWithOffsets(indexReader, 0,

In the end, if I look at the map "allWeightedSpanTerms" - I don't have any
weighted span terms & when I tried to debug the code I found that when it is
trying to build the TermContext the statement "fields.terms(field);" is
returning "null" which I don't understand.

My query is : "Running Apple" (a phrase query)
my doc contents are :
name : Running Apple 60 GB iPod with Video Playback Black - Apple

Please let me know on what I'm doing anything wrong.


View this message in context:
Sent from the Lucene - Java Users mailing list archive at

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

View raw message