lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrien Grand <jpou...@gmail.com>
Subject Re: Lucene 4.0.0 - find term position.
Date Fri, 07 Dec 2012 16:34:03 GMT
Hi Vitaly,

On Fri, Dec 7, 2012 at 3:24 PM, <Vitaly_Artemov@mcafee.com> wrote:

> I try to use or  Terms tfvector = reader.getTermVector(docId, "contents");
> or  Fields fields = reader.getTermVectors(docId);
> but I get null from these calls.
> What is wrong?


These methods will always return null unless you turn term vectors on at
indexing time (see FieldType.setStoreTermVectors[1]
and FieldType.setStoreTermVectorPositions[2]).

 [1]
http://lucene.apache.org/core/4_0_0/core/org/apache/lucene/document/FieldType.html#setStoreTermVectors(boolean)
 [2]
http://lucene.apache.org/core/4_0_0/core/org/apache/lucene/document/FieldType.html#setStoreTermVectorPositions(boolean)

-- 
Adrien

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message