Example #1
0
        public void Set(ref OriginalDocumentPositionList odpl)
        {
            DocumentId = odpl.DocumentId;

            int count = odpl.CountAndWordCount / 8;

            if (count > Int16.MaxValue)
            {
                Count = Int16.MaxValue;
            }
            else if (count <= 0)
            {
                Count = 1;
            }
            else
            {
                Count = (Int16)count;
            }

            _TotalWordsInThisDocumentIndex = (Int16)(odpl.CountAndWordCount % 8);

            FirstPosition = odpl.FirstPosition;

            Next = -1;
        }
Example #2
0
        static public void GetNextOriginalDocumentPositionList(ref OriginalDocumentPositionList odpl,
                                                               ref int docId, BufferMemory bufferMemory, bool simple)
        {
            if (docId < 0)
            {
                docId           = VInt.sReadFromBuffer(bufferMemory.Buf, ref bufferMemory.Position);
                odpl.DocumentId = docId;

                odpl.CountAndWordCount = VInt.sReadFromBuffer(bufferMemory.Buf, ref bufferMemory.Position);

                if (!simple)
                {
                    odpl.FirstPosition = VInt.sReadFromBuffer(bufferMemory.Buf, ref bufferMemory.Position);
                }

                //return odpl;
            }
            else
            {
                byte b = bufferMemory.Buf[bufferMemory.Position];

                if (b < 128)
                {
                    docId += b;
                    bufferMemory.Position++;
                }
                else
                {
                    docId = VInt.sReadFromBuffer(bufferMemory.Buf, ref bufferMemory.Position) + docId;
                }


                odpl.DocumentId = docId;

                b = bufferMemory.Buf[bufferMemory.Position];
                if (b < 128)
                {
                    odpl.CountAndWordCount = b;
                    bufferMemory.Position++;
                }
                else
                {
                    odpl.CountAndWordCount = VInt.sReadFromBuffer(bufferMemory.Buf, ref bufferMemory.Position);
                }

                if (!simple)
                {
                    b = bufferMemory.Buf[bufferMemory.Position];
                    if (b < 128)
                    {
                        odpl.FirstPosition = b;
                        bufferMemory.Position++;
                    }
                    else
                    {
                        odpl.FirstPosition = VInt.sReadFromBuffer(bufferMemory.Buf, ref bufferMemory.Position);
                    }
                }

                //return odpl;
            }
        }