Пример #1
0
 @Override
 public void collect(int doc) throws IOException {
   BytesWrap parentId = typeCache.parentIdByDoc(doc);
   if (parentId == null) {
     return;
   }
   for (Tuple<IndexReader, IdReaderTypeCache> tuple : readers) {
     IndexReader indexReader = tuple.v1();
     IdReaderTypeCache idReaderTypeCache = tuple.v2();
     if (idReaderTypeCache
         == null) { // might be if we don't have that doc with that type in this reader
       continue;
     }
     int parentDocId = idReaderTypeCache.docById(parentId);
     if (parentDocId != -1 && !indexReader.isDeleted(parentDocId)) {
       OpenBitSet docIdSet = parentDocs().get(indexReader.getCoreCacheKey());
       if (docIdSet == null) {
         docIdSet = new OpenBitSet(indexReader.maxDoc());
         parentDocs.put(indexReader.getCoreCacheKey(), docIdSet);
       }
       docIdSet.fastSet(parentDocId);
       return;
     }
   }
 }
Пример #2
0
    @Override
    public void collect(int doc) throws IOException {
      if (typeCache == null) {
        return;
      }

      HashedBytesArray parentUid = typeCache.idByDoc(doc);
      uidToScore.put(parentUid, scorer.score());
    }
 @Override
 public final void collect(int doc) throws IOException {
   if (typeCache != null) {
     HashedBytesArray parentIdByDoc = typeCache.parentIdByDoc(doc);
     if (parentIdByDoc != null) {
       collect(doc, parentIdByDoc);
     }
   }
 }
Пример #4
0
 @Override
 public int advance(int target) throws IOException {
   currentChildDoc = childrenIterator.advance(target);
   if (currentChildDoc == DocIdSetIterator.NO_MORE_DOCS) {
     return currentChildDoc;
   }
   BytesReference uid = typeCache.idByDoc(currentChildDoc);
   if (uid == null) {
     return nextDoc();
   }
   currentScore = uidToScore.get(uid);
   if (currentScore == 0) {
     return nextDoc();
   }
   return currentChildDoc;
 }
Пример #5
0
    @Override
    public int nextDoc() throws IOException {
      while (true) {
        currentChildDoc = childrenIterator.nextDoc();
        if (currentChildDoc == DocIdSetIterator.NO_MORE_DOCS) {
          return currentChildDoc;
        }

        BytesReference uid = typeCache.parentIdByDoc(currentChildDoc);
        if (uid == null) {
          continue;
        }
        currentScore = uidToScore.get(uid);
        if (currentScore != 0) {
          return currentChildDoc;
        }
      }
    }
Пример #6
0
      @Override
      public int advance(int target) throws IOException {
        if (remaining == 0) {
          return currentDocId = NO_MORE_DOCS;
        }

        currentDocId = parentsIterator.advance(target);
        if (currentDocId == DocIdSetIterator.NO_MORE_DOCS) {
          return currentDocId;
        }

        HashedBytesArray uid = idTypeCache.idByDoc(currentDocId);
        if (uidToScore.containsKey(uid)) {
          // Can use lget b/c uidToScore is only used by one thread at the time (via CacheRecycler)
          currentScore = uidToScore.lget();
          remaining--;
          return currentDocId;
        } else {
          return nextDoc();
        }
      }