How to get positions from a document term vector in Lucene?

前端 未结 2 1535
野性不改
野性不改 2020-12-18 08:26

I need to iterate over all documents in a Lucene index, and obtain the positions at which each term occurs in each document. As far as I am able to understand from the Lucen

相关标签:
2条回答
  • 2020-12-18 08:39

    Your code ran properly when i tried it.
    Are you adding the FieldType properly to the document?
    I did this:

    Field ff = new Field("name", "value", ft);
    document.add(ff);
    
    0 讨论(0)
  • 2020-12-18 08:47

    Did you set FieldType.setStoreTermVectorPositions(true) on your field type at index time? http://lucene.apache.org/core/5_5_0/core/org/apache/lucene/document/FieldType.html#setStoreTermVectorPositions(boolean)

    0 讨论(0)
提交回复
热议问题