/** * As the priority queue have one result for each node, when we fetch a result we have to recharge * the queue (getting the next score doc from the correct node) * * @param scoreDoc * @return */ private ClusteredTopDocs rechargeQueue(ClusteredDoc scoreDoc) { // "recharging" the queue // the queue has a top element of each node. As we removed a element, we have to get the next // element from this node and put on the queue. ClusteredTopDocs topDoc = topDocsResponses.get(scoreDoc.getNodeUuid()); ScoreDoc score = topDoc.getNext(); // if score == null -> this node does not have more results... if (score != null) { hq.add(score); } return topDoc; }
protected Object fetchValue(ClusteredDoc scoreDoc, ClusteredTopDocs topDoc) { ISPNEagerTopDocs eagerTopDocs = (ISPNEagerTopDocs) topDoc.getTopDocs(); return cache.get(eagerTopDocs.keys[scoreDoc.getIndex()]); }