本文整理了Java中org.apache.lucene.index.Term.equals()
方法的一些代码示例,展示了Term.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Term.equals()
方法的具体详情如下:
包路径:org.apache.lucene.index.Term
类名称:Term
方法名:equals
[英]Compares two terms, returning true iff they have the same field and text.
[中]比较两个术语,如果它们具有相同的字段和文本,则返回true。
代码示例来源:origin: org.apache.lucene/lucene-core
/** Returns true iff <code>other</code> is equal to <code>this</code>. */
@Override
public boolean equals(Object other) {
return sameClassAs(other) &&
term.equals(((TermQuery) other).term);
}
代码示例来源:origin: org.apache.lucene/lucene-core
@Override
public boolean equals(Object other) {
return sameClassAs(other) &&
term.equals(((SpanTermQuery) other).term);
}
代码示例来源:origin: org.apache.lucene/lucene-core
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
// super.equals() ensures we are the same class
PrefixQuery other = (PrefixQuery) obj;
if (!term.equals(other.term)) {
return false;
}
return true;
}
}
代码示例来源:origin: org.apache.lucene/lucene-core
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
FuzzyQuery other = (FuzzyQuery) obj;
if (maxEdits != other.maxEdits)
return false;
if (prefixLength != other.prefixLength)
return false;
if (maxExpansions != other.maxExpansions)
return false;
if (transpositions != other.transpositions)
return false;
if (term == null) {
if (other.term != null)
return false;
} else if (!term.equals(other.term))
return false;
return true;
}
代码示例来源:origin: org.apache.lucene/lucene-core
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
AutomatonQuery other = (AutomatonQuery) obj;
if (!compiled.equals(other.compiled))
return false;
if (term == null) {
if (other.term != null)
return false;
} else if (!term.equals(other.term))
return false;
return true;
}
代码示例来源:origin: tjake/Solandra
public void seek(Term term) throws IOException
{
if (termEnum.skipTo(term))
{
if (termEnum.term().equals(term))
{
termDocs = termEnum.getTermDocFreq();
}
else
{
termDocs = null;
}
}
docPosition = -1;
}
代码示例来源: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: 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: tjake/Solandra
@Override
public boolean next() throws IOException
{
if(termView.size() == 0)
return false;
// current term is in tree
termView = termView.tailMap(currentTermEntry.getKey(), false);
currentTermEntry = termView.firstEntry() == null ? currentTermEntry : termView.firstEntry();
// rebuffer from last key
if (termView.size() == 0)
{
//logger.info("Rebuffering terms");
termView = termCache.skipTo(currentTermEntry.getKey());
if (termView.size() == 0 ||
(termView.size() == 1 && termView.firstEntry().getKey().equals(currentTermEntry.getKey())))
{
currentTermEntry = null;
return false;
}
else
{
termView = termView.tailMap(currentTermEntry.getKey(), false);
currentTermEntry = termView.firstEntry();
}
}
return true;
}
代码示例来源:origin: tjake/Solandra
public int docFreq(Term term) throws IOException
{
LucandraTermInfo[] docs = getCache().termCache.get(term);
if (docs != null)
return docs.length;
LucandraTermEnum termEnum = new LucandraTermEnum(this);
if (termEnum.skipTo(term) && termEnum.term().equals(term))
{
return termEnum.docFreq();
}
return 0;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Delete delete = (Delete) o;
return version == delete.version &&
seqNo == delete.seqNo &&
primaryTerm == delete.primaryTerm &&
uid.equals(delete.uid) &&
versionType == delete.versionType;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene
/** Returns true iff <code>other</code> is equal to <code>this</code>. */
@Override
public boolean equals(Object other) {
return sameClassAs(other) &&
term.equals(((TermQuery) other).term);
}
代码示例来源:origin: org.infinispan/infinispan-embedded-query
/** Returns true iff <code>o</code> is equal to this. */
@Override
public boolean equals(Object o) {
if (!(o instanceof TermQuery)) return false;
TermQuery other = (TermQuery) o;
return super.equals(o) && this.term.equals(other.term);
}
代码示例来源:origin: cheng-li/pyramid
/** Returns true iff <code>o</code> is equal to this. */
@Override
public boolean equals(Object other) {
return sameClassAs(other) &&
term.equals(((TermCountQuery) other).term);
}
代码示例来源:origin: harbby/presto-connectors
@Override
public boolean equals(Object obj) {
if (! super.equals(obj)) {
return false;
}
SpanTermQuery other = (SpanTermQuery) obj;
return term.equals(other.term);
}
代码示例来源:origin: kzwang/elasticsearch-image
@Override
public boolean equals(Object o) {
if (!(o instanceof ImageHashQuery))
return false;
ImageHashQuery other = (ImageHashQuery)o;
return (this.getBoost() == other.getBoost())
&& this.term.equals(other.term)
& luceneFieldName.equals(luceneFieldName)
&& lireFeature.equals(lireFeature);
}
代码示例来源:origin: sirensolutions/siren
/** Returns true iff <code>o</code> is equal to this. */
@Override
public boolean equals(final Object o) {
if (!(o instanceof NodeTermQuery)) return false;
final NodeTermQuery other = (NodeTermQuery) o;
return (this.getBoost() == other.getBoost()) &&
this.term.equals(other.term) &&
this.levelConstraint == other.levelConstraint &&
this.lowerBound == other.lowerBound &&
this.upperBound == other.upperBound &&
StringUtils.equals(this.datatype, other.datatype);
}
代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene
/** Returns true iff <code>o</code> is equal to this. */
public boolean equals(Object o) {
if (!(o instanceof SpanTermQuery))
return false;
SpanTermQuery other = (SpanTermQuery)o;
return (this.getBoost() == other.getBoost())
&& this.term.equals(other.term);
}
代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof MultiTermQuery)) return false;
final MultiTermQuery multiTermQuery = (MultiTermQuery) o;
if (!term.equals(multiTermQuery.term)) return false;
return getBoost() == multiTermQuery.getBoost();
}
代码示例来源:origin: tamingtext/book
protected float calculateWeight(Term term, IndexReader reader) throws IOException {
//if a term is not in the index, then it's weight is 0
TermEnum termEnum = reader.terms(term);
if (termEnum != null && termEnum.term() != null && termEnum.term().equals(term)) {
return 1.0f / termEnum.docFreq();
} else {
log.warn("Couldn't find doc freq for term {}", term);
return 0;
}
}
内容来源于网络,如有侵权,请联系作者删除!