lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Willnauer <simon.willna...@gmail.com>
Subject Re: Token Stream with Offsets (Token Sources class)
Date Mon, 08 Apr 2013 06:39:32 GMT
hey,

first, please don't crosspost! second, can you provide more infos like
that part where you index the data. maybe something that is
selfcontained?

simon

On Mon, Apr 8, 2013 at 1:16 AM, vempap <phani.vempaty@emc.com> wrote:
> 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
>

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