lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ankit Murarka <ankit.mura...@rancoretech.com>
Subject Trying to store Offsets. Dont know the exact meaning of some terms.
Date Tue, 13 Aug 2013 11:45:39 GMT
Hello,
          I generally add fields to my document in the following manner. 
I wish to add offsets to this field.

doc.add(new StringField("contents",line,Field.Store.YES));

I wish to also store offsets. So, I went through javadoc, and found I 
need to use FieldType.

So, I ended up using :

FieldType fieldType = new  FieldType(TextField.TYPE_STORED);
                  fieldType.setIndexed(true);
                 
fieldType.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
                 fieldType.setStored(true);
                fieldType.setStoreTermVectorOffsets(true);

and then I added this field to the document in the following manner:
  doc.add(new Field("contents", line, fieldType));

Problems I encountered:
a. Exception : Exception in thread "main" 
java.lang.IllegalArgumentException: cannot index term vector offsets 
when term vectors are not indexed (field="contents
b. I hardly know what are the above setters doing.,. I googled it and 
found the above setters and hence used it.
c. I tried to understand what is Term Vector etc. but I was hardly able 
to understand it.

Kindly provide some guidance..


-- 
Regards

Ankit


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