@Override protected int compare(int i, int j) { return terms[i].compareTo(terms[j]); } }.sort(0, terms.length);
@Override public int compareTo(PostingsAndFreq other) { if (position != other.position) { return position - other.position; } if (nTerms != other.nTerms) { return nTerms - other.nTerms; } if (nTerms == 0) { return 0; } for (int i=0; i<terms.length; i++) { int res = terms[i].compareTo(other.terms[i]); if (res!=0) { return res; } } return 0; }
@Override public int compareTo(PostingsAndFreq other) { if (position != other.position) { return position - other.position; } if (nTerms != other.nTerms) { return nTerms - other.nTerms; } if (nTerms == 0) { return 0; } for (int i=0; i<terms.length; i++) { int res = terms[i].compareTo(other.terms[i]); if (res!=0) return res; } return 0; }
public ConcurrentNavigableMap<Term, LucandraTermInfo[]> skipTo(Term skip) throws IOException { Pair<Term, Term> range = null; int bufferSize = termList.isEmpty() ? 1 : 3; // verify we've buffered sufficiently Map.Entry<Term, Pair<Term, Term>> tailEntry = termQueryBoundries.ceilingEntry(skip); boolean needsBuffering = true; if (tailEntry != null) { range = tailEntry.getValue(); //skip term must be within a buffered range avoid rebuffering if (skip.compareTo(range.left) >= 0 && (!range.right.equals(emptyTerm) && skip.compareTo(range.right) < 0)) { needsBuffering = false; } } ConcurrentNavigableMap<Term, LucandraTermInfo[]> subList = emptyMap; if (needsBuffering) { range = bufferTerms(skip, bufferSize); } //logger.info(Thread.currentThread().getName()+" rebuffered "+needsBuffering+" "+range); if (skip.compareTo(range.left) >= 0 && (!range.right.equals(emptyTerm)) && skip.compareTo(range.right) <= 0) { subList = termList.subMap(skip, true, range.right, true); } return subList; }
if(queryRange.right == null || queryRange.right.compareTo(term) < 0) queryRange.right = term;
/** add a term. This fully consumes in the incoming {@link BytesRef}. */ public void add(String field, BytesRef bytes) { assert lastTerm.equals(new Term("")) || new Term(field, bytes).compareTo(lastTerm) > 0; try { final int prefix; if (size > 0 && field.equals(lastTerm.field)) { // same field as the last term prefix = StringHelper.bytesDifference(lastTerm.bytes, bytes); output.writeVInt(prefix << 1); } else { // field change prefix = 0; output.writeVInt(1); output.writeString(field); } int suffix = bytes.length - prefix; output.writeVInt(suffix); output.writeBytes(bytes.bytes, bytes.offset + prefix, suffix); lastTermBytes.copyBytes(bytes); lastTerm.bytes = lastTermBytes.get(); lastTerm.field = field; size += 1; } catch (IOException e) { throw new RuntimeException(e); } }
do { Term term = terms.term(); if (term.compareTo(rightBoundary) >= 0) { break;
protected boolean termCompare(Term term) { int compare = term.compareTo(upper); if (compare > 0) { endEnum = true; } return compare <= 0; }
protected boolean termCompare(Term term) { int compare = term.compareTo(upper); if (compare > 0) { endEnum = true; } return compare <= 0; }
protected boolean lessThan(Object a, Object b) { ScoreTerm termA = (ScoreTerm)a; ScoreTerm termB = (ScoreTerm)b; if (termA.score == termB.score) return termA.term.compareTo(termB.term) > 0; else return termA.score < termB.score; }
protected final boolean lessThan(Object a, Object b) { SegmentMergeInfo stiA = (SegmentMergeInfo)a; SegmentMergeInfo stiB = (SegmentMergeInfo)b; int comparison = stiA.term.compareTo(stiB.term); if (comparison == 0) return stiA.base < stiB.base; else return comparison < 0; }
@Override protected boolean lessThan(ScoreTerm termA, ScoreTerm termB) { if (termA.score == termB.score) return termA.term.compareTo(termB.term) > 0; else return termA.score < termB.score; }
@Override protected int compare(int i, int j) { return terms[i].compareTo(terms[j]); } }.sort(0, terms.length);
protected boolean lessThan(Object a, Object b) { ScoreTerm termA = (ScoreTerm)a; ScoreTerm termB = (ScoreTerm)b; if (termA.score == termB.score) return termA.term.compareTo(termB.term) > 0; else return termA.score < termB.score; }
protected boolean termCompare(Term term) { int compare = term.compareTo(upper); if (compare > 0) { endEnum = true; } return compare <= 0; }
@Override protected int compare(int i, int j) { return terms[i].compareTo(terms[j]); } }.sort(0, terms.length);
protected final boolean lessThan(Object a, Object b) { SegmentMergeInfo stiA = (SegmentMergeInfo)a; SegmentMergeInfo stiB = (SegmentMergeInfo)b; int comparison = stiA.term.compareTo(stiB.term); if (comparison == 0) return stiA.base < stiB.base; else return comparison < 0; }
@Override protected boolean lessThan(ScoreTerm termA, ScoreTerm termB) { if (termA.score== termB.score) return termA.term.compareTo(termB.term) > 0; else return termA.score < termB.score; }
@Override protected int compare(int i, int j) { return terms[i].compareTo(terms[j]); } }.sort(0, terms.length);
/** Scans within block for matching term. */ private final TermInfo scanEnum(Term term) throws IOException { SegmentTermEnum enumerator = getEnum(); while (term.compareTo(enumerator.term()) > 0 && enumerator.next()) {} if (enumerator.term() != null && term.compareTo(enumerator.term()) == 0) return enumerator.termInfo(); else return null; }