TermFrequencyList.getEventId(key)); TermWeightPosition.Builder position = new TermWeightPosition.Builder(); for (int i = 0; i < twInfo.getTermOffsetCount(); i++) { position.setTermWeightOffsetInfo(twInfo, i); offsets.put(twZone, position.build()); position.reset();
TermWeightPosition.Builder twpBuilder = new TermWeightPosition.Builder(); TermWeightPosition lowTWP = twpBuilder.setOffset(maxFirstTWP).build(); TermWeightPosition highTWP = twpBuilder.setOffset(minLastTWP).build();
@Override public void collect(Value value) { // Make sure we don't aggregate something else if (value == null || value.get().length == 0) { return; } TermWeight.Info info; try { info = TermWeight.Info.parseFrom(value.get()); } catch (InvalidProtocolBufferException e) { log.error("Value passed to aggregator was not of type TermWeight.Info", e); return; } // Add each offset into the list maintaining sorted order TermWeightPosition.Builder builder = new TermWeightPosition.Builder(); for (int i = 0; i < info.getTermOffsetCount(); i++) { builder.setTermWeightOffsetInfo(info, i); offsets.add(builder.build()); builder.reset(); } }
private TermWeightPosition getPosition(int offset) { return new TermWeightPosition.Builder().setOffset(offset).build(); }
public Builder setTermWeightOffsetInfo(TermWeight.Info info, int i) { setOffset(info.getTermOffset(i)); // Only pull the previous skips if the counts match the offsets // offsets, skips, and scores are linked by index so array lengths must match if (info.getTermOffsetCount() == info.getPrevSkipsCount()) { setPrevSkips(info.getPrevSkips(i)); } // Only pull the scores if the counts match the offsets if (info.getTermOffsetCount() == info.getScoreCount()) { setScore(info.getScore(i)); } setZeroOffsetMatch(info.getZeroOffsetMatch()); return this; }
private TermWeightPosition getPosition(int offset, boolean zeroOffsetMatch) { return new TermWeightPosition.Builder().setOffset(offset).setZeroOffsetMatch(zeroOffsetMatch).build(); }
private TermWeightPosition getPosition(int offset, int prevSkips, float score) { return new TermWeightPosition.Builder().setOffset(offset).setPrevSkips(prevSkips).setScore(TermWeightPosition.positionScoreToTermWeightScore(score)) .build(); }
private TermWeightPosition getPosition(int offset, int prevSkips, boolean zeroOffsetMatch) { return new TermWeightPosition.Builder().setOffset(offset).setPrevSkips(prevSkips).setZeroOffsetMatch(zeroOffsetMatch).build(); }