Java Code Examples for org.apache.lucene.util.ToStringUtils

The following examples show how to use org.apache.lucene.util.ToStringUtils. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Elasticsearch   Source File: BlendedTermQuery.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public String toString(String field) {
    StringBuilder builder = new StringBuilder("blended(terms:[");
    for (int i = 0; i < terms.length; ++i) {
        builder.append(terms[i]);
        float boost = 1f;
        if (boosts != null) {
            boost = boosts[i];
        }
        builder.append(ToStringUtils.boost(boost));
        builder.append(", ");
    }
    if (terms.length > 0) {
        builder.setLength(builder.length() - 2);
    }
    builder.append("])");
    builder.append(ToStringUtils.boost(getBoost()));
    return builder.toString();
}
 
Example 2
/** Prints a user-readable version of this query. */
public String toString(String field) {
  StringBuffer buffer = new StringBuffer();
  if (!term.field().equals(field)) {
    buffer.append(term.field());
    buffer.append(":");
  }
  buffer.append(term.text());
  buffer.append(ToStringUtils.boost(getBoost()));
  return buffer.toString();
}
 
Example 3
Source Project: Elasticsearch   Source File: DateFieldMapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString(String s) {
    final StringBuilder sb = new StringBuilder();
    return sb.append(names().indexName()).append(':')
        .append(includeLower ? '[' : '{')
        .append((lowerTerm == null) ? "*" : lowerTerm.toString())
        .append(" TO ")
        .append((upperTerm == null) ? "*" : upperTerm.toString())
        .append(includeUpper ? ']' : '}')
        .append(ToStringUtils.boost(getBoost()))
        .toString();
}
 
Example 4
Source Project: Elasticsearch   Source File: FiltersFunctionScoreQuery.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString(String field) {
    StringBuilder sb = new StringBuilder();
    sb.append("function score (").append(subQuery.toString(field)).append(", functions: [");
    for (FilterFunction filterFunction : filterFunctions) {
        sb.append("{filter(").append(filterFunction.filter).append("), function [").append(filterFunction.function).append("]}");
    }
    sb.append("])");
    sb.append(ToStringUtils.boost(getBoost()));
    return sb.toString();
}
 
Example 5
Source Project: Elasticsearch   Source File: FunctionScoreQuery.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString(String field) {
    StringBuilder sb = new StringBuilder();
    sb.append("function score (").append(subQuery.toString(field)).append(",function=").append(function).append(')');
    sb.append(ToStringUtils.boost(getBoost()));
    return sb.toString();
}
 
Example 6
Source Project: coming   Source File: 1139461_WildcardQuery_0_s.java    License: MIT License 5 votes vote down vote up
/** Prints a user-readable version of this query. */
@Override
public String toString(String field) {
  StringBuilder buffer = new StringBuilder();
  if (!term.field().equals(field)) {
    buffer.append(term.field());
    buffer.append(":");
  }
  buffer.append(term.text());
  buffer.append(ToStringUtils.boost(getBoost()));
  return buffer.toString();
}
 
Example 7
Source Project: coming   Source File: 1139461_WildcardQuery_0_t.java    License: MIT License 5 votes vote down vote up
/** Prints a user-readable version of this query. */
@Override
public String toString(String field) {
  StringBuilder buffer = new StringBuilder();
  if (!term.field().equals(field)) {
    buffer.append(term.field());
    buffer.append(":");
  }
  buffer.append(term.text());
  buffer.append(ToStringUtils.boost(getBoost()));
  return buffer.toString();
}
 
Example 8
Source Project: elasticsearch-image   Source File: ImageHashQuery.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString(String field) {
    StringBuilder buffer = new StringBuilder();
    if (!term.field().equals(field)) {
        buffer.append(term.field());
        buffer.append(":");
    }
    buffer.append(term.text());
    buffer.append(";");
    buffer.append(luceneFieldName);
    buffer.append(",");
    buffer.append(lireFeature.getClass().getSimpleName());
    buffer.append(ToStringUtils.boost(getBoost()));
    return buffer.toString();
}
 
Example 9
Source Project: elasticsearch-image   Source File: ImageHashLimitQuery.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString(String field) {
    StringBuilder buffer = new StringBuilder();
    buffer.append(hashFieldName);
    buffer.append(",");
    buffer.append(Arrays.toString(hashes));
    buffer.append(",");
    buffer.append(maxResult);
    buffer.append(",");
    buffer.append(luceneFieldName);
    buffer.append(",");
    buffer.append(lireFeature.getClass().getSimpleName());
    buffer.append(ToStringUtils.boost(getBoost()));
    return buffer.toString();
}
 
Example 10
Source Project: elasticsearch-image   Source File: ImageQuery.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString(String field) {
    StringBuilder buffer = new StringBuilder();
    buffer.append(luceneFieldName);
    buffer.append(",");
    buffer.append(lireFeature.getClass().getSimpleName());
    buffer.append(ToStringUtils.boost(getBoost()));
    return buffer.toString();
}
 
Example 11
Source Project: Elasticsearch   Source File: ChildrenQuery.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString(String field) {
    int max = maxChildren == 0 ? Integer.MAX_VALUE : maxChildren;
    return "ChildrenQuery[min(" + Integer.toString(minChildren) + ") max(" + Integer.toString(max) + ")of " + childType + "/"
            + parentType + "](" + childQuery.toString(field) + ')' + ToStringUtils.boost(getBoost());
}
 
Example 12
Source Project: Elasticsearch   Source File: ParentQuery.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString(String field) {
    return "ParentQuery[" + parentType + "](" + parentQuery.toString(field) + ')' + ToStringUtils.boost(getBoost());
}
 
Example 13
Source Project: Elasticsearch   Source File: MultiPhrasePrefixQuery.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public final String toString(String f) {
    StringBuilder buffer = new StringBuilder();
    if (field == null || !field.equals(f)) {
        buffer.append(field);
        buffer.append(":");
    }

    buffer.append("\"");
    Iterator<Term[]> i = termArrays.iterator();
    while (i.hasNext()) {
        Term[] terms = i.next();
        if (terms.length > 1) {
            buffer.append("(");
            for (int j = 0; j < terms.length; j++) {
                buffer.append(terms[j].text());
                if (j < terms.length - 1) {
                    if (i.hasNext()) {
                        buffer.append(" ");
                    } else {
                        buffer.append("* ");
                    }
                }
            }
            if (i.hasNext()) {
                buffer.append(") ");
            } else {
                buffer.append("*)");
            }
        } else {
            buffer.append(terms[0].text());
            if (i.hasNext()) {
                buffer.append(" ");
            } else {
                buffer.append("*");
            }
        }
    }
    buffer.append("\"");

    if (slop != 0) {
        buffer.append("~");
        buffer.append(slop);
    }

    buffer.append(ToStringUtils.boost(getBoost()));

    return buffer.toString();
}
 
Example 14
Source Project: Elasticsearch   Source File: AllTermQuery.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String toString(String field) {
    return new TermQuery(term).toString(field) + ToStringUtils.boost(getBoost());
}