In the indexing method I use the following line:
Field contentsField = new Field("contents", new FileReader(f), Field.TermVector.YES);
However, in Lucene 4.0 this constructor is deprecated and new TextField
should be used instead of new Field
.
But the problem with TextField
is that it don't accept TermVector
in its constructors.
Is there a way to include the Term Vector in my indexing in Lucene 4.0 with the new constructors?
Thanks
I had the same problem, so I just simply created my own Field:
}
Hope this helps
TextField is a convenience class for users who need indexed fields without term vectors. If you need terms vectors, just use a Field. It takes a few more lines of code since you need to create an instance of FieldType first, set
storeTermVectors
andtokenizer
to true and then use thisFieldType
instance inField
constructor.