Package it.unimi.dsi.fastutil.longs

Examples of it.unimi.dsi.fastutil.longs.LongPriorityQueue


   
    //the number of documents with non-zero score.
    numberOfRetrievedDocuments = 0;
   
    // The posting list min heap for minimum selection
        LongPriorityQueue postingHeap = new LongHeapPriorityQueue();
   
    // The posting list iterator array (one per term) and initialization
    for (int i = 0; i < plm.size(); i++) {
      long docid = plm.getPosting(i).getId();
      assert(docid != IterablePosting.EOL);
      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;
                long elem = postingHeap.firstLong();
                currentPostingListIndex = (int) (elem & 0xFFFF);
                currentPosting = plm.getPosting(currentPostingListIndex);
                nextDocid = (int) (elem >>> 32);
            } while (nextDocid == currentDocId);
           
View Full Code Here


    numberOfRetrievedDocuments = 0;
   
    // The posting list min heap for minimum selection
    // longs are kept, as these contain both the docid (high byte)
    // and the corresponding query term array index (low byte)
        final LongPriorityQueue postingHeap = new LongHeapPriorityQueue();
   
    final int queryLength = queryTermsToMatchList.size();
    // The posting list iterator array (one per term) and initialization
    IterablePosting postingListArray[] = new IterablePosting[queryLength];
        for (int i = 0; i < queryLength; i++) {
      LexiconEntry           lexiconEntry = queryTermsToMatchList.get(i).getValue();
      if(logger.isDebugEnabled()) logger.debug((i + 1) + ": " + queryTermStrings[i].trim() + " with " + lexiconEntry.getDocumentFrequency() + " documents (TF is " + lexiconEntry.getFrequency() + ").");
      postingListArray[i] = invertedIndex.getPostings((BitIndexPointer)lexiconEntry);
      postingListArray[i].next();
      long docid = postingListArray[i].getId();
      assert(docid != -1);
      postingHeap.enqueue((docid << 32) + i);
    }
        boolean targetResultSetSizeReached = false;
        final Queue<CandidateResult> candidateResultList = new PriorityQueue<CandidateResult>();
        int currentDocId = selectMinimumDocId(postingHeap);
        IterablePosting currentPosting = null;
        double threshold = 0.0d;
        //int scored = 0;
       
        //while not end of all posting lists
        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 = postingListArray[currentPostingListIndex];
            //scored++;
            do {
              assignScore(currentPostingListIndex, wm[currentPostingListIndex], currentCandidate, currentPosting);
              long newDocid = postingListArray[currentPostingListIndex].next();
              postingHeap.dequeueLong();
                if (newDocid != IterablePosting.EOL)
                    postingHeap.enqueue((newDocid << 32) + currentPostingListIndex);
                else if (postingHeap.isEmpty())
                    break;
                long elem = postingHeap.firstLong();
                currentPostingListIndex = (int) (elem & 0xFFFF);
                currentPosting = postingListArray[currentPostingListIndex];
                nextDocid = (int) (elem >>> 32);
            } while (nextDocid == currentDocId);
           
View Full Code Here

TOP

Related Classes of it.unimi.dsi.fastutil.longs.LongPriorityQueue

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.