@Override protected AcceptStatus accept(BytesRef term) { return term.equals(singleRef) ? AcceptStatus.YES : AcceptStatus.END; }
@Override public boolean equals(Object other) { if (other == this) { return true; } if (other instanceof PayloadAttribute) { PayloadAttributeImpl o = (PayloadAttributeImpl) other; if (o.payload == null || payload == null) { return o.payload == null && payload == null; } return o.payload.equals(payload); } return false; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Term other = (Term) obj; if (field == null) { if (other.field != null) return false; } else if (!field.equals(other.field)) return false; if (bytes == null) { if (other.bytes != null) return false; } else if (!bytes.equals(other.bytes)) return false; return true; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; CompiledAutomaton other = (CompiledAutomaton) obj; if (type != other.type) return false; if (type == AUTOMATON_TYPE.SINGLE) { if (!term.equals(other.term)) return false; } else if (type == AUTOMATON_TYPE.NORMAL) { if (!runAutomaton.equals(other.runAutomaton)) return false; } return true; } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; TermRangeQuery other = (TermRangeQuery) obj; if (includeLower != other.includeLower) return false; if (includeUpper != other.includeUpper) return false; if (lowerTerm == null) { if (other.lowerTerm != null) return false; } else if (!lowerTerm.equals(other.lowerTerm)) return false; if (upperTerm == null) { if (other.upperTerm != null) return false; } else if (!upperTerm.equals(other.upperTerm)) return false; return true; } }
/** returns true if term is within k edits of the query term */ private boolean matches(BytesRef termIn, int k) { return k == 0 ? termIn.equals(term.bytes()) : automata[k].runAutomaton.run(termIn.bytes, termIn.offset, termIn.length); }
@Override public boolean equalsSameType(Object other) { assert exists || 0 == value.length(); MutableValueStr b = (MutableValueStr)other; return value.get().equals(b.value.get()) && exists == b.exists; }
/** Add the {@link #top()} slice as well as all slices that are positionned * on the same term to {@code tops} and return how many of them there are. */ int fillTop(TermsEnumWithSlice[] tops) { final int size = size(); if (size == 0) { return 0; } tops[0] = top(); int numTop = 1; stack[0] = 1; int stackLen = 1; while (stackLen != 0) { final int index = stack[--stackLen]; final int leftChild = index << 1; for (int child = leftChild, end = Math.min(size, leftChild + 1); child <= end; ++child) { TermsEnumWithSlice te = get(child); if (te.current.equals(tops[0].current)) { tops[numTop++] = te; stack[stackLen++] = child; } } } return numTop; }
/** * Creates a new {@link TermInSetQuery} from the given collection of terms. */ public TermInSetQuery(String field, Collection<BytesRef> terms) { BytesRef[] sortedTerms = terms.toArray(new BytesRef[terms.size()]); // already sorted if we are a SortedSet with natural order boolean sorted = terms instanceof SortedSet && ((SortedSet<BytesRef>)terms).comparator() == null; if (!sorted) { ArrayUtil.timSort(sortedTerms); } PrefixCodedTerms.Builder builder = new PrefixCodedTerms.Builder(); BytesRefBuilder previous = null; for (BytesRef term : sortedTerms) { if (previous == null) { previous = new BytesRefBuilder(); } else if (previous.get().equals(term)) { continue; // deduplicate } builder.add(field, term); previous.copyBytes(term); } this.field = field; termData = builder.finish(); termDataHashCode = termData.hashCode(); }
top[numTop++] = currentSubs[i]; current = currentSubs[i].current = currentSubs[i].terms.term(); assert term.equals(currentSubs[i].current);
throw new RuntimeException("seek to last term " + lastTerm.get() + " failed"); if (termsEnum.term().equals(lastTerm.get()) == false) { throw new RuntimeException("seek to last term " + lastTerm.get() + " returned FOUND but seeked to the wrong term " + termsEnum.term()); throw new RuntimeException("seek to existing term " + seekTerms[i] + " failed"); if (termsEnum.term().equals(seekTerms[i]) == false) { throw new RuntimeException("seek to existing term " + seekTerms[i] + " returned FOUND but seeked to the wrong term " + termsEnum.term());
/** * Returns <code>true</code> iff the length and the checksums are the same. otherwise <code>false</code> */ public boolean isSame(StoreFileMetaData other) { if (checksum == null || other.checksum == null) { // we can't tell if either or is null so we return false in this case! this is why we don't use equals for this! return false; } return length == other.length && checksum.equals(other.checksum) && hash.equals(other.hash); }
if (!payload.equals(postingsPayload)) { throw new RuntimeException("vector term=" + term + " field=" + field + " doc=" + j + " has payload=" + payload + " but differs from postings payload=" + postingsPayload);
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Candidate other = (Candidate) obj; if (term == null) { if (other.term != null) return false; } else { if (!term.equals(other.term)) return false; } return true; }
@Override public void collect(int doc, long bucket) throws IOException { if (currentValueIsSet == false) { if (dvs.advanceExact(doc)) { long ord; while ((ord = dvs.nextOrd()) != NO_MORE_ORDS) { if (term.equals(lookup.lookupOrd(ord))) { currentValueIsSet = true; currentValue = ord; break; } } } } assert currentValueIsSet; next.collect(doc, bucket); } };
queue.updateTop(); if (queue.top().currentTerm.equals(scratch.get()) == false) { break;
public static int sortAndDedup(final BytesRefArray bytes, final int[] indices) { final BytesRefBuilder scratch = new BytesRefBuilder(); final BytesRefBuilder scratch1 = new BytesRefBuilder(); final int numValues = bytes.size(); assert indices.length >= numValues; if (numValues <= 1) { return numValues; } sort(scratch, scratch1, bytes, indices); int uniqueCount = 1; BytesRefBuilder previous = scratch; BytesRefBuilder current = scratch1; bytes.get(previous, indices[0]); for (int i = 1; i < numValues; ++i) { bytes.get(current, indices[i]); if (!previous.get().equals(current.get())) { indices[uniqueCount++] = indices[i]; } BytesRefBuilder tmp = previous; previous = current; current = tmp; } return uniqueCount; }
@Override public void collect(int doc, long bucket) throws IOException { assert bucket == 0; if (values.advanceExact(doc)) { final int valuesCount = values.docValueCount(); // SortedBinaryDocValues don't guarantee uniqueness so we // need to take care of dups previous.clear(); for (int i = 0; i < valuesCount; ++i) { final BytesRef bytes = values.nextValue(); if (includeExclude != null && !includeExclude.accept(bytes)) { continue; } if (i > 0 && previous.get().equals(bytes)) { continue; } long bucketOrdinal = bucketOrds.add(bytes); if (bucketOrdinal < 0) { // already seen bucketOrdinal = -1 - bucketOrdinal; collectExistingBucket(sub, doc, bucketOrdinal); } else { collectBucket(sub, doc, bucketOrdinal); } previous.copyBytes(bytes); } } } };
previousAnalyzed.copyBytes(analyzed); seenSurfaceForms.add(BytesRef.deepCopyOf(surface)); } else if (analyzed.get().equals(previousAnalyzed.get())) { dedup++; if (dedup >= maxSurfaceFormsPerAnalyzedForm) {
TermStatistics existing = termStatistics.get(terms[i]); if (existing != null) { assert terms[i].bytes().equals(existing.term());