org.apache.lucene.index.Term.toString()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中org.apache.lucene.index.Term.toString()方法的一些代码示例,展示了Term.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Term.toString()方法的具体详情如下:
包路径:org.apache.lucene.index.Term
类名称:Term
方法名:toString

Term.toString介绍

[英]Returns human-readable form of the term text. If the term is not unicode, the raw bytes will be printed instead.
[中]返回术语文本的可读形式。如果术语不是unicode,则将打印原始字节。

代码示例

代码示例来源:origin: org.apache.lucene/lucene-core

@Override
public String toString() {
 return "spans(" + term.toString() + ")@" +
     (doc == -1 ? "START" : (doc == NO_MORE_DOCS) ? "ENDDOC"
      : doc + " - " + (position == NO_MORE_POSITIONS ? "ENDPOS" : position));
}

代码示例来源:origin: org.apache.lucene/lucene-core

/** Returns the text of this term.  In the case of words, this is simply the
 text of the word.  In the case of dates and other types, this is an
 encoding of the object as a string.  */
public final String text() {
 return toString(bytes);
}

代码示例来源:origin: org.apache.lucene/lucene-core

/** Prints a user-readable version of this query. */
@Override
public String toString(String field) {
 StringBuilder buffer = new StringBuilder();
 if (!getField().equals(field)) {
  buffer.append(getField());
  buffer.append(":");
 }
 buffer.append(includeLower ? '[' : '{');
 // TODO: all these toStrings for queries should just output the bytes, it might not be UTF-8!
 buffer.append(lowerTerm != null ? ("*".equals(Term.toString(lowerTerm)) ? "\\*" : Term.toString(lowerTerm))  : "*");
 buffer.append(" TO ");
 buffer.append(upperTerm != null ? ("*".equals(Term.toString(upperTerm)) ? "\\*" : Term.toString(upperTerm)) : "*");
 buffer.append(includeUpper ? ']' : '}');
 return buffer.toString();
}

代码示例来源:origin: org.apache.lucene/lucene-core

@Override
public String toString(String field) {
 StringBuilder buffer = new StringBuilder();
 if (term.field().equals(field))
  buffer.append(term.text());
 else
  buffer.append(term.toString());
 return buffer.toString();
}

代码示例来源:origin: org.apache.lucene/lucene-core

@Override
public String toString(String defaultField) {
 StringBuilder builder = new StringBuilder();
 builder.append(field);
 builder.append(":(");
 TermIterator iterator = termData.iterator();
 boolean first = true;
 for (BytesRef term = iterator.next(); term != null; term = iterator.next()) {
  if (!first) {
   builder.append(' ');
  }
  first = false;
  builder.append(Term.toString(term));
 }
 builder.append(')');
 return builder.toString();
}

代码示例来源:origin: org.elasticsearch/elasticsearch

@Override
  public String toString(String field) {
    StringBuilder builder = new StringBuilder();
    for (BytesRef type : types) {
      if (builder.length() > 0) {
        builder.append(' ');
      }
      builder.append(new Term(CONTENT_TYPE, type).toString());
    }
    return builder.toString();
  }
}

代码示例来源:origin: flaxsearch/luwak

@Override
  public String toString() {
    return type + " " + term.toString() + (payload == null ? "" : "{" + payload + "}");
  }
}

代码示例来源:origin: org.pageseeder.flint/pso-flint-lucene

/**
 * {@inheritDoc}
 */
@Override
public String toString() {
 return this._prefix.toString();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

@Override
public String toString() {
 return "spans(" + term.toString() + ")@" +
     (doc == -1 ? "START" : (doc == NO_MORE_DOCS) ? "ENDDOC"
      : doc + " - " + (position == NO_MORE_POSITIONS ? "ENDPOS" : position));
}

代码示例来源:origin: org.apache.lucene/com.springsource.org.apache.lucene

/** Prints a user-readable version of this query. */
 public String toString () {
  StringBuffer buffer = new StringBuffer();
  buffer.append("PrefixFilter(");
  buffer.append(prefix.toString());
  buffer.append(")");
  return buffer.toString();
 }
}

代码示例来源:origin: org.dspace.dependencies.solr/dspace-solr-core

@Override
 public String toString () {
  StringBuilder sb = new StringBuilder();
  sb.append("PrefixFilter(");
  sb.append(prefix.toString());
  sb.append(")");
  return sb.toString();
 }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

@Override
  public String toString(String field) {
    StringBuilder builder = new StringBuilder();
    for (BytesRef type : types) {
      if (builder.length() > 0) {
        builder.append(' ');
      }
      builder.append(new Term(CONTENT_TYPE, type).toString());
    }
    return builder.toString();
  }
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

/** Prints a user-readable version of this filter. */
@Override
public String toString(String field) {
 StringBuilder buffer = new StringBuilder();
 buffer.append("PrefixFilter(");
 buffer.append(getPrefix().toString());
 buffer.append(")");
 return buffer.toString();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

@Override
public String toString(String field) {
 StringBuilder buffer = new StringBuilder();
 if (term.field().equals(field))
  buffer.append(term.text());
 else
  buffer.append(term.toString());
 return buffer.toString();
}

代码示例来源:origin: cheng-li/pyramid

@Override
public String toString(String field) {
  StringBuilder buffer = new StringBuilder();
  if (term.field().equals(field))
    buffer.append(term.text());
  else
    buffer.append(term.toString());
  return buffer.toString();
}

代码示例来源:origin: lucene/lucene

public String toString(String field) {
 if (term.field().equals(field))
  return term.text();
 else
  return term.toString();
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

@Override
public String toString(String field) {
 StringBuilder buffer = new StringBuilder();
 if (term.field().equals(field))
  buffer.append(term.text());
 else
  buffer.append(term.toString());
 buffer.append(ToStringUtils.boost(getBoost()));
 return buffer.toString();
}

代码示例来源:origin: org.apache.lucene/lucene-core-jfrog

public String toString(String field) {
 StringBuffer buffer = new StringBuffer();
 if (term.field().equals(field))
  buffer.append(term.text());
 else
  buffer.append(term.toString());
 buffer.append(ToStringUtils.boost(getBoost()));
 return buffer.toString();
}

代码示例来源:origin: org.apache.lucene/lucene-queries

/**
 * Creates a constant value source returning the docFreq of a given term
 *
 * @see IndexReader#docFreq(Term)
 */
public static DoubleValuesSource docFreq(Term term) {
 return new IndexReaderDoubleValuesSource(r -> (double) r.docFreq(term), "docFreq(" + term.toString() + ")");
}

代码示例来源:origin: org.apache.lucene/lucene-queries

/**
 * Creates a constant value source returning the totalTermFreq for a given term
 *
 * @see IndexReader#totalTermFreq(Term)
 */
public static DoubleValuesSource totalTermFreq(Term term) {
 return new IndexReaderDoubleValuesSource(r -> r.totalTermFreq(term), "totalTermFreq(" + term.toString() + ")");
}

相关文章