lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andi rexha <>
Subject Term vector Lucene 4.2
Date Tue, 02 Apr 2013 08:56:35 GMT
I have a problem while trying to extract term vector's attributes (i.e. position of the terms).
What I have done was: 

Terms termVector = indexReader.getTermVector(docId, fieldName);
        TermsEnum reuse = null;
        TermsEnum iterator = termVector.iterator(reuse);
        PositionIncrementAttribute attribute =  iterator.attributes().getAttribute(PositionIncrementAttribute.class);
        BytesRef ref = null;
        while ((ref = != null) {

I get an Exception : 
This AttributeSource does not have the attribute 'org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute'.

>From the API I didn't find any other way to extract the information. Could you please
help me? 
Thanks in advance
Best regards, Andi

ps. I have tried to open the index with Luke and the term vector's attributes are stored in
the index. 
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message