예제 #1
0
 private SegmentTermVector[] ReadTermVectors(int docNum, System.String[] fields, long[] tvfPointers)
 {
     SegmentTermVector[] res = new SegmentTermVector[fields.Length];
     for (int i = 0; i < fields.Length; i++)
     {
         var mapper = new ParallelArrayTermVectorMapper();
         mapper.SetDocumentNumber(docNum);
         ReadTermVector(fields[i], tvfPointers[i], mapper);
         res[i] = (SegmentTermVector)mapper.MaterializeVector();
     }
     return(res);
 }
예제 #2
0
        /// <summary> Construct the vector</summary>
        /// <returns> The <see cref="ITermFreqVector" /> based on the mappings.
        /// </returns>
        public virtual ITermFreqVector MaterializeVector()
        {
            SegmentTermVector tv = null;

            if (field != null && terms != null)
            {
                if (storingPositions || storingOffsets)
                {
                    tv = new SegmentTermPositionVector(field, terms, termFreqs, positions, offsets);
                }
                else
                {
                    tv = new SegmentTermVector(field, terms, termFreqs);
                }
            }
            return(tv);
        }