private SolrQuery initSolrQuery(Query entityhubQuery) { SolrQuery query = new SolrQuery(); // first add a filterquery for the domain if present if (domain != null) { query.addFilterQuery(String.format("%s:%s", fieldMapper.getDocumentDomainField(), SolrUtil.escapeSolrSpecialChars(domain))); } // than add the offset query.setStart(entityhubQuery.getOffset()); // and the limit if (entityhubQuery.getLimit() != null) { if (entityhubQuery.getLimit().compareTo(MAX_QUERY_RESULTS) <= 0) { query.setRows(entityhubQuery.getLimit()); } else { log.warn(String.format( "Parsed Number of QueryResults {} is greater than the allowed maximum of {}!", entityhubQuery.getLimit(), MAX_QUERY_RESULTS)); entityhubQuery.setLimit(MAX_QUERY_RESULTS); } } else { // maybe remove that to prevent to many results! But for now I would // rather like to have a default value within the FieldQuery! // e.g. set by the FieldQueryFactory when creating new queries! query.setRows(DEFAULT_QUERY_RESULTS); entityhubQuery.setLimit(DEFAULT_QUERY_RESULTS); } return query; }
private SolrQuery initSolrQuery(Query entityhubQuery) { SolrQuery query = new SolrQuery(); // first add a filterquery for the domain if present if (domain != null) { query.addFilterQuery(String.format("%s:%s", fieldMapper.getDocumentDomainField(), SolrUtil.escapeSolrSpecialChars(domain))); } // than add the offset query.setStart(entityhubQuery.getOffset()); // and the limit if (entityhubQuery.getLimit() != null) { if (entityhubQuery.getLimit().compareTo(MAX_QUERY_RESULTS) <= 0) { query.setRows(entityhubQuery.getLimit()); } else { log.warn(String.format( "Parsed Number of QueryResults {} is greater than the allowed maximum of {}!", entityhubQuery.getLimit(), MAX_QUERY_RESULTS)); entityhubQuery.setLimit(MAX_QUERY_RESULTS); } } else { // maybe remove that to prevent to many results! But for now I would // rather like to have a default value within the FieldQuery! // e.g. set by the FieldQueryFactory when creating new queries! query.setRows(DEFAULT_QUERY_RESULTS); entityhubQuery.setLimit(DEFAULT_QUERY_RESULTS); } return query; }