On Mon, 30 Jul 2007, Bernhard Jung wrote:

I stumbled across the problem of using term vectors with position and
offset information in pylucene. I use fields with
Field.TermVectors.WITH_POSITIONS_OFFSETS set and the getTermFreqVector
method of IndexReader to retrieve the term vector, but this is of type
TermFrequencyVector and not of TermPositionVector (a sub-interface of
TermFrequencyVector), which would provide the method getTermPositions
and getOffsets that I want to use.

I patched lucene.cpp of the latest subversion trunk (of 2007-07-30) to
provide downcast methods from TermFrequencyVector to TermPositionVector
(isTermPositionVector and toTermPositionVector).

I'd like to share this patch or be corrected if I somehow follow a wrong
way to get the positions and offsets of terms in a document.

Find attached the patch and an example script that makes use of the
downcasted TermPositionVector.

I checked-in your patch into svn trunk revision 337.

Thank you for your contribution !

Andi..
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev

Reply via email to