/** * Skips to the first match (including the current) whose entity, tuple and cell numbers are * greater than or equal to the given targets. <br> * When this method is used the {@link #explain(int)} method should not be used. <br> * The implementation uses the skipTo() method on the subscorers. * * @param entityID The target entity number. * @param tupleID The target tuple number. * @param cellID The target cell number. * @return true iff there is such a match. */ @Override public int advance(final int entityID, final int tupleID, final int cellID) throws IOException { if (scorerCellQueue == null) { this.initScorerCellQueue(); } if (entityID < entity || (entityID == entity && tupleID <= tuple) || (entityID == entity && tupleID == tuple && cellID <= cell)) { return entity; } while (queueSize > 0) { if (scorerCellQueue.topEntity() > entityID || (scorerCellQueue.topEntity() == entityID && (scorerCellQueue.topTuple() != Integer.MAX_VALUE && scorerCellQueue.topTuple() >= tupleID)) || (scorerCellQueue.topEntity() == entityID && scorerCellQueue.topTuple() == tupleID && (scorerCellQueue.topCell() != Integer.MAX_VALUE && scorerCellQueue.topCell() >= cellID))) { entity = scorerCellQueue.topEntity(); this.nextPosition(); return entity; } else if (!scorerCellQueue.topSkipToAndAdjustElsePop(entityID, tupleID, cellID)) { if (--queueSize == 0) { return NO_MORE_DOCS; } } } return NO_MORE_DOCS; }
/** * Skips to the first match (including the current) whose document number is greater than or equal * to a given target. <br> * When this method is used the {@link #explain(int)} method should not be used. <br> * The implementation uses the skipTo() method on the subscorers. * * @param entityID The target entity number. * @return true iff there is such a match. */ @Override public int advance(final int entityID) throws IOException { if (scorerCellQueue == null) { this.initScorerCellQueue(); } if (entityID <= entity) { return entity; } while (queueSize > 0) { if (scorerCellQueue.topEntity() >= entityID) { entity = scorerCellQueue.topEntity(); this.nextPosition(); // advance to the first position [SRN-24] return entity; } else if (!scorerCellQueue.topSkipToAndAdjustElsePop(entityID)) { if (--queueSize == 0) { return NO_MORE_DOCS; } } } return NO_MORE_DOCS; }