Exemple #1
0
            public TVTerms(Lucene3xTermVectorsReader outerInstance, long tvfFP)
            {
                this.outerInstance = outerInstance;
                outerInstance.tvf.Seek(tvfFP);
                numTerms = outerInstance.tvf.ReadVInt32();
                byte bits = outerInstance.tvf.ReadByte();

                storePositions   = (bits & STORE_POSITIONS_WITH_TERMVECTOR) != 0;
                storeOffsets     = (bits & STORE_OFFSET_WITH_TERMVECTOR) != 0;
                tvfFPStart       = outerInstance.tvf.GetFilePointer();
                unicodeSortOrder = outerInstance.SortTermsByUnicode();
            }
            public TVFields(Lucene3xTermVectorsReader outerInstance, int docID)
            {
                this.outerInstance = outerInstance;
                outerInstance.SeekTvx(docID);
                outerInstance.tvd.Seek(outerInstance.tvx.ReadInt64());

                int fieldCount = outerInstance.tvd.ReadVInt32();

                if (Debugging.AssertsEnabled)
                {
                    Debugging.Assert(fieldCount >= 0);
                }
                if (fieldCount != 0)
                {
                    fieldNumbers = new int[fieldCount];
                    fieldFPs     = new long[fieldCount];
                    for (int fieldUpto = 0; fieldUpto < fieldCount; fieldUpto++)
                    {
                        int fieldNumber = outerInstance.tvd.ReadVInt32();
                        fieldNumbers[fieldUpto]         = fieldNumber;
                        fieldNumberToIndex[fieldNumber] = fieldUpto;
                    }

                    long position = outerInstance.tvx.ReadInt64();
                    fieldFPs[0] = position;
                    for (int fieldUpto = 1; fieldUpto < fieldCount; fieldUpto++)
                    {
                        position           += outerInstance.tvd.ReadVInt64();
                        fieldFPs[fieldUpto] = position;
                    }
                }
                else
                {
                    // TODO: we can improve writer here, eg write 0 into
                    // tvx file, so we know on first read from tvx that
                    // this doc has no TVs
                    fieldNumbers = null;
                    fieldFPs     = null;
                }
            }
 // NOTE: tvf is pre-positioned by caller
 public TVTermsEnum(Lucene3xTermVectorsReader outerInstance)
 {
     this.outerInstance = outerInstance;
     this.origTVF       = outerInstance.tvf;
     tvf = (IndexInput)origTVF.Clone();
 }