本文整理了Java中org.apache.lucene.index.Term.compareTo()
方法的一些代码示例,展示了Term.compareTo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Term.compareTo()
方法的具体详情如下:
包路径:org.apache.lucene.index.Term
类名称:Term
方法名:compareTo
[英]Compares two terms, returning a negative integer if this term belongs before the argument, zero if this term is equal to the argument, and a positive integer if this term belongs after the argument. The ordering of terms is first by field, then by text.
[中]比较两个项,如果该项属于参数之前,则返回一个负整数;如果该项等于参数,则返回零;如果该项属于参数之后,则返回一个正整数。术语的顺序是先按字段,然后按文本。
代码示例来源:origin: org.apache.lucene/lucene-core
@Override
protected int compare(int i, int j) {
return terms[i].compareTo(terms[j]);
}
}.sort(0, terms.length);
代码示例来源:origin: oracle/opengrok
@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;
}
代码示例来源:origin: org.apache.lucene/lucene-core
@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;
}
代码示例来源:origin: tjake/Solandra
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;
}
代码示例来源:origin: tjake/Solandra
if(queryRange.right == null || queryRange.right.compareTo(term) < 0)
queryRange.right = term;
代码示例来源:origin: org.apache.lucene/lucene-core
/** 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);
}
}
代码示例来源:origin: linkedin/indextank-engine
do {
Term term = terms.term();
if (term.compareTo(rightBoundary) >= 0) {
break;
代码示例来源:origin: org.apache.jackrabbit/jackrabbit-core
protected boolean termCompare(Term term) {
int compare = term.compareTo(upper);
if (compare > 0) {
endEnum = true;
}
return compare <= 0;
}
代码示例来源:origin: org.exoplatform.jcr/exo.jcr.component.core
protected boolean termCompare(Term term) {
int compare = term.compareTo(upper);
if (compare > 0) {
endEnum = true;
}
return compare <= 0;
}
代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene
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;
}
代码示例来源:origin: org.apache.lucene/lucene-core-jfrog
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;
}
代码示例来源:origin: org.apache.lucene/lucene-classification
@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;
}
代码示例来源:origin: org.infinispan/infinispan-embedded-query
@Override
protected int compare(int i, int j) {
return terms[i].compareTo(terms[j]);
}
}.sort(0, terms.length);
代码示例来源:origin: org.apache.lucene/lucene-core-jfrog
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;
}
代码示例来源:origin: apache/jackrabbit
protected boolean termCompare(Term term) {
int compare = term.compareTo(upper);
if (compare > 0) {
endEnum = true;
}
return compare <= 0;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene
@Override
protected int compare(int i, int j) {
return terms[i].compareTo(terms[j]);
}
}.sort(0, terms.length);
代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene
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;
}
代码示例来源:origin: org.apache.lucene/lucene-sandbox
@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;
}
代码示例来源:origin: harbby/presto-connectors
@Override
protected int compare(int i, int j) {
return terms[i].compareTo(terms[j]);
}
}.sort(0, terms.length);
代码示例来源:origin: lucene/lucene
/** 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;
}
内容来源于网络,如有侵权,请联系作者删除!