lucene-java-user mailing list archives

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

  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(
				"<path-to-index-dir>");
		FSDirectory directory = FSDirectory.open(path);
		IndexReader indexReader = DirectoryReader.open(directory);

		Map<String, WeightedSpanTerm> allWeightedSpanTerms = new HashMap<String,
WeightedSpanTerm>();

		WeightedSpanTermExtractor extractor = null;
		extractor = new WeightedSpanTermExtractor();
		TokenStream tokenStream = null;
		tokenStream = TokenSources.getTokenStreamWithOffsets(indexReader, 0,
"name");
		allWeightedSpanTerms.putAll(extractor.getWeightedSpanTerms(q,
tokenStream));

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.

Thanks.




--
View this message in context: http://lucene.472066.n3.nabble.com/Token-Stream-with-Offsets-Token-Sources-class-tp4054383.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
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