/** * * Conditional if to allow these positions based on offset True if zeroOffset is not allowed, and offsets are equal. False if zeroOffsets are allowed. * * @param o * Other position * @return True if zeroOffset is not allowed, and offsets are equal */ public boolean isZeroOffset(EvaluateTermPosition o) { if ((!this.termWeightPosition.getZeroOffsetMatch()) || (!o.termWeightPosition.getZeroOffsetMatch())) { if (this.termWeightPosition.getOffset() == o.termWeightPosition.getOffset()) { if (log.isTraceEnabled()) { log.trace("EvaluateTermPosition.isZeroOffset: " + this.termWeightPosition.getOffset() + " == " + o.termWeightPosition.getOffset()); } return true; } } return false; }
case FORWARD: low = termWeightPosition.getLowOffset(); high = termWeightPosition.getOffset() + distance; eval = o; break; case REVERSE: low = o.termWeightPosition.getLowOffset(); high = o.termWeightPosition.getOffset() + distance; eval = this; break; log.trace("EvaluateTermPosition.isWithIn: " + low + "<=" + eval.termWeightPosition.getOffset() + " && " + eval.termWeightPosition.getLowOffset() + "<=" + high); return (low <= eval.termWeightPosition.getOffset() && eval.termWeightPosition.getLowOffset() <= high);
int minLastTWP = minLastOffset.getOffset() + (terms.length - minLastTermIndex - 1) * distance; for (int i = minLastTermIndex; i < maxSkips.length; i++) { minLastTWP += maxSkips[i];
@Override public Value aggregate() { for (TermWeightPosition offset : offsets) { builder.addTermOffset(offset.getOffset()); if (0 <= offset.getPrevSkips()) { builder.addPrevSkips(offset.getPrevSkips()); } if (0 <= offset.getScore()) { builder.addScore(offset.getScore()); } // If the zeroOffset has been set and the termweight is still default(true) if (builder.getZeroOffsetMatch()) { builder.setZeroOffsetMatch(offset.getZeroOffsetMatch()); } } return new Value(builder.build().toByteArray()); }