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, Phani. -- View this message in context: http://lucene.472066.n3.nabble.com/Token-Stream-with-Offsets-Token-Sources-class-tp4054385.html Sent from the Lucene - Java Developer mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org