Package org.terrier.structures.postings

Examples of org.terrier.structures.postings.IterablePosting


      int lastId = 0;
      int nonZeroEntryCount = 0;
      float maxProgress = 0;
      while(rr.next(key, value))
      {
        IterablePosting ip = value.getObject();
        lastId = key.get();
        while(ip.next() != IterablePosting.EOL)
        {
          pointers++;
        }
        nonZeroEntryCount++;
        if (rr.getProgress() > maxProgress)
View Full Code Here


      //count can be greater than entry count due to entry skipping
      if ((entryIndex - startingEntryIndex) >= entryCount )
        return false;
      if (! postingStream.hasNext())
        return false;
      IterablePosting rtr = postingStream.next();
     
      //System.err.println("skipped=" + postingStream.getEntriesSkipped());
      entryIndex += postingStream.getEntriesSkipped();
     
      if (rtr == null)
View Full Code Here

  /** Take an iterator of postings. Each posting is inverted, and the a new posting generated */
  public void map(IntWritable termId, Wrapper<IterablePosting> postingWrapper,
      OutputCollector<VIntWritable, Posting> collector, Reporter reporter)
      throws IOException
  {
    final IterablePosting postingIterator = postingWrapper.getObject();
    reporter.setStatus("Mapping for id " + termId);
    while(postingIterator.next() != IterablePosting.EOL)
    {
      WritablePosting wp = postingIterator.asWritablePosting();
      int docid = postingIterator.getId();
      wp.setId(termId.get());
      reporter.progress();
      collector.collect(new VIntWritable(docid), wp);
    }
  }
View Full Code Here

    }
    DirectIndex direct = index.getDirectIndex();
    DocumentIndex doc = index.getDocumentIndex();
    DocumentIndexEntry die = doc.getDocumentEntry(Integer.parseInt(args[0]));
    System.err.println("docid" + args[0] + " pointer = "+ die.toString());
    IterablePosting pi = direct.getPostings(die);
    System.out.print(args[0] + " ");
    while(pi.next() != IterablePosting.EOL)
    {
      System.out.print("(" + pi.getId() + ", " + pi.getFrequency() + ") ");
    }
    System.out.println();
  }
View Full Code Here

      if(DEBUG) System.err.println("skipping "+ (pointer.getOffsetBits() - file.getBitOffset()) + "bits");
      file.skipBits(pointer.getOffsetBits() - file.getBitOffset());
    }
    currentPointer = pointer;
    currentEntryCount = pointer.getNumberOfEntries();
    IterablePosting rtr = null;
    try{
      rtr = (fieldCount > 0)
        ? postingConstructor.newInstance(file, pointer.getNumberOfEntries(), getDocumentIndex(pointer), fieldCount)
        : postingConstructor.newInstance(file, pointer.getNumberOfEntries(), getDocumentIndex(pointer));
    } catch (Exception e) {
View Full Code Here

 
    try{
      int entryIndex = 0;
      while(this.hasNext())
      {
        IterablePosting ip = this.next();
        entryIndex += this.getEntriesSkipped();
        System.out.print(entryIndex + " ");
        while(ip.next() != IterablePosting.EOL)
        {
          System.out.print(ip.toString());
          System.out.print(" ");
        }
        System.out.println();
        entryIndex++;
      }
View Full Code Here

   * {@inheritDoc}
   */
  public IterablePosting getPostings(BitIndexPointer pointer) throws IOException
  {
    final BitIn _file = this.file[pointer.getFileNumber()].readReset(pointer.getOffset(), pointer.getOffsetBits());
    IterablePosting rtr = null;
   
    DocumentIndex fixedDi = pointer instanceof DocumentIndexEntry
      ? new DocidSpecificDocumentIndex(index.getDocumentIndex(), (DocumentIndexEntry)pointer)
      : null;
   
View Full Code Here

   
    //the number of documents with non-zero score.
    numberOfRetrievedDocuments = 0;
   
    //the pointers read from the inverted file
    IterablePosting postings;   
   
    //inform the weighting model of the collection statistics
   

    //for each query term in the query
View Full Code Here

      return resultSet;
    }
           
    int queryLength = queryTermsToMatchList.size();
    // The posting list iterator from the inverted file
    IterablePosting postings;   
    for (int i = 0; i < queryLength; i++)
    {
      LexiconEntry lexiconEntry = queryTermsToMatchList.get(i).getValue();
      postings = invertedIndex.getPostings((BitIndexPointer)lexiconEntry);
      assignScores(i, wm[i], (AccumulatorResultSet) resultSet, postings);
View Full Code Here

      postingHeap.enqueue((docid << 32) + i);
    }
        boolean targetResultSetSizeReached = false;
        Queue<CandidateResult> candidateResultList = new PriorityQueue<CandidateResult>();
        int currentDocId = selectMinimumDocId(postingHeap);
        IterablePosting currentPosting = null;
        double threshold = 0.0d;
        //int scored = 0;
       
        while (currentDocId != -1)  {
            // We create a new candidate for the doc id considered
            CandidateResult currentCandidate = new CandidateResult(currentDocId);
           
            int currentPostingListIndex = (int) (postingHeap.firstLong() & 0xFFFF), nextDocid;
            //System.err.println("currentDocid="+currentDocId+" currentPostingListIndex="+currentPostingListIndex);
            currentPosting = plm.getPosting(currentPostingListIndex);
            //scored++;
            do {
              assignScore(currentPostingListIndex, currentCandidate);
              //assignScore(currentPostingListIndex, wm[currentPostingListIndex], currentCandidate, currentPosting);
              long newDocid = currentPosting.next();
              postingHeap.dequeueLong();
                if (newDocid != IterablePosting.EOL)
                    postingHeap.enqueue((newDocid << 32) + currentPostingListIndex);
                else if (postingHeap.isEmpty())
                    break;
View Full Code Here

TOP

Related Classes of org.terrier.structures.postings.IterablePosting

Copyright © 2018 www.massapicom. 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.