Logo Search packages:      
Sourcecode: qt4-x11 version File versions

bool SegmentTermEnum::next (  ) 

Moves the current of the set to the next in the set

Definition at line 145 of file SegmentTermEnum.cpp.

References indexPointer, isIndex, position, readTerm(), size, and termInfo.

Referenced by scanTo().

                                {
      //Func - Moves the current of the set to the next in the set
      //Pre  - true
      //Post - If the end has been reached NULL is returned otherwise the term has
      //       become the next Term in the enumeration

            //Increase position by and and check if the end has been reached
            if (position++ >= size-1) {
                  //delete term
                  _CLDECDELETE(_term);
                  return false;
            }

            //delete the previous enumerated term
            Term* tmp=NULL;
            if ( prev != NULL ){
                  int32_t usage = prev->__cl_refcount;
                  if ( usage > 1 ){
                        _CLDECDELETE(prev); //todo: tune other places try and delete its term 
                  }else
                        tmp = prev; //we are going to re-use this term
            }
            //prev becomes the current enumerated term
            prev = _term;
            //term becomes the next term read from inputStream input
            _term = readTerm(tmp);

            //Read docFreq, the number of documents which contain the term.
            termInfo->docFreq = input->readVInt();
            //Read freqPointer, a pointer into the TermFreqs file (.frq)
            termInfo->freqPointer += input->readVLong();
            
            //Read proxPointer, a pointer into the TermPosition file (.prx).
            termInfo->proxPointer += input->readVLong();

      if(format == -1){
         //  just read skipOffset in order to increment  file pointer; 
         // value is never used since skipTo is switched off
         if (!isIndex) {
            if (termInfo->docFreq > formatM1SkipInterval) {
               termInfo->skipOffset = input->readVInt(); 
            }
         }
      }else{
         if (termInfo->docFreq >= skipInterval) 
            termInfo->skipOffset = input->readVInt();
      }

            //Check if the enumeration is an index
            if (isIndex)
                  //read index pointer
                  indexPointer += input->readVLong();

            return true;
      }


Generated by  Doxygen 1.6.0   Back to index