Java Code Examples for org.apache.solr.common.params.SolrParams#toString()

The following examples show how to use org.apache.solr.common.params.SolrParams#toString() . 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 File: CollapsingQParserPlugin.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
/**
 * returns a new GroupHeadSelector based on the specified local params
 */
public static GroupHeadSelector build(final SolrParams localParams) {
  final String sortString = StringUtils.defaultIfBlank(localParams.get(SORT), null);
  final String max = StringUtils.defaultIfBlank(localParams.get("max"), null);
  final String min = StringUtils.defaultIfBlank(localParams.get("min"), null);

  if (1 < numNotNull(min, max, sortString)) {
    throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
                            "At most one localparam for selecting documents (min, max, sort) may be specified: " + localParams.toString());
  }

  if (null != sortString) {
    return new GroupHeadSelector(sortString, GroupHeadSelectorType.SORT);
  } else if (null != min) {
    return new GroupHeadSelector(min, GroupHeadSelectorType.MIN);
  } else if (null != max) {
    return new GroupHeadSelector(max, GroupHeadSelectorType.MAX);
  }
  // default
  return new GroupHeadSelector("score", GroupHeadSelectorType.SCORE);
}
 
Example 2
Source File: CrossCollectionJoinQuery.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
public CrossCollectionJoinQuery(String query, String zkHost, String solrUrl,
                                String collection, String fromField, String toField,
                                boolean routedByJoinKey, int ttl, SolrParams otherParams) {

  this.query = query;
  this.zkHost = zkHost;
  this.solrUrl = solrUrl;
  this.collection = collection;
  this.fromField = fromField;
  this.toField = toField;
  this.routedByJoinKey = routedByJoinKey;

  this.timestamp = System.nanoTime();
  this.ttl = ttl;

  this.otherParams = otherParams;
  // SolrParams doesn't implement equals(), so use this string to compare them
  if (otherParams != null) {
    this.otherParamsString = otherParams.toString();
  }
}