Package it.unimi.dsi.io

Examples of it.unimi.dsi.io.InputBitStream.position()


        cacheBitStreamOut.flush();
        ibs = cacheBitStreamIn;
        ibs.flush();
      }

      ibs.position( 0 );

      currDoc = -1;
      for( int j = totalFrequency; j-- != 0; ) {
        obs = indexWriter.newDocumentRecord();
        indexWriter.writeDocumentPointer( obs, currDoc = ibs.readDelta() + currDoc + 1 );
View Full Code Here


        else {
          // We sort position by pointed document pointer.
          LongArrays.quickSort( position, 0, documentCount, new AbstractLongComparator() {
            public int compare( final long position0, final long position1 ) {
              try {
                ibs.position( position0 );
                final int d0 = ibs.readDelta();
                ibs.position( position1 );
                return d0 - ibs.readDelta();
              }
              catch ( IOException e ) {
View Full Code Here

          LongArrays.quickSort( position, 0, documentCount, new AbstractLongComparator() {
            public int compare( final long position0, final long position1 ) {
              try {
                ibs.position( position0 );
                final int d0 = ibs.readDelta();
                ibs.position( position1 );
                return d0 - ibs.readDelta();
              }
              catch ( IOException e ) {
                throw new RuntimeException( e );
              }
View Full Code Here

              }
            }
          } );
          for ( int i = 0; i < documentCount; i++ ) {
            obs = indexWriter.newDocumentRecord();
            ibs.position( position[ i ] );
            indexWriter.writeDocumentPointer( obs, ibs.readDelta() );
            payload.read( ibs );
            indexWriter.writePayload( obs, payload );
          }
View Full Code Here

          indexWriter.newInvertedList();
          indexWriter.writeFrequency( actualFrequency );

          int currPointer;
          for ( int j = 0; j < frequency; j++ ) {
            ibs.position( bitPos[ j ] );
            obs = indexWriter.newDocumentRecord();
            indexWriter.writeDocumentPointer( obs, currPointer = ibs.readDelta() );
            if ( ASSERTS ) assert currPointer == pointer[ j ];
            if ( hasCounts ) count = ibs.readGamma() + 1;
            if ( hasPositions ) {
View Full Code Here

              for ( int p = 1; p < count; p++ ) pos[ p ] += pos[ p - 1 ] + 1;
            }

            if ( indexingIsVirtual ) {
              while( j < frequency - 1 ) {
                ibs.position( bitPos[ j + 1 ] );
                if ( currPointer != ibs.readDelta() ) break;
                j++;
                if ( hasCounts ) moreCount = ibs.readGamma() + 1;
                if ( hasPositions ) {
                  pos = IntArrays.grow( pos, count + moreCount, count );
View Full Code Here

          ibs = indirect[ i ];
          ibs.flush();
          temp[ i ].flush();
        }

        ibs.position( 0 );
         
        indexWriter[ i ].writeFrequency( localFrequency[ i ] );
        for( int j = 0; j < localFrequency[ i ]; j++ ) {
          obs = indexWriter[ i ].newDocumentRecord();
          globalPointer = ibs.readGamma();
View Full Code Here

    final long[] nonTermFrequency = collection.exact ? new long[ (int)collection.nonTerms ] : null;
    final InputBitStream documentsIbs = collection.documentsInputBitStream;
    final DocumentFactory factory = collection.factory;
    final boolean exact = collection.exact;
    final MutableString s = new MutableString();
    documentsIbs.position( 0 );
    for( int i = (int)collection.documents; i-- != 0; ) {
      readSelfDelimitedUtf8String( documentsIbs, s ); // Skip URI
      readSelfDelimitedUtf8String( documentsIbs, s ); // Skip title
      for( int f = factory.numberOfFields() - 1; f-- !=0; ) {
        int len = documentsIbs.readDelta();
View Full Code Here

      for( int i = invNonTermPerm.length; i-- != 0; ) invNonTermPerm[ nonTermPerm[ i ] ] = i;
    }

    File newDocumentsFile = File.createTempFile( SimpleCompressedDocumentCollection.class.getSimpleName(), "temp", new File( basename.toString() ).getParentFile() );
    OutputBitStream newDocumentsObs = new OutputBitStream( newDocumentsFile );
    documentsIbs.position( 0 );
    for( int i = (int)collection.documents; i-- != 0; ) {
      readSelfDelimitedUtf8String( documentsIbs, s ); // Skip URI
      SimpleCompressedDocumentCollectionBuilder.writeSelfDelimitedUtf8String( newDocumentsObs, s );
      readSelfDelimitedUtf8String( documentsIbs, s ); // Skip title
      SimpleCompressedDocumentCollectionBuilder.writeSelfDelimitedUtf8String( newDocumentsObs, s );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.