本文整理了Java中org.apache.solr.client.solrj.request.QueryRequest.process
方法的一些代码示例,展示了QueryRequest.process
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueryRequest.process
方法的具体详情如下:
包路径:org.apache.solr.client.solrj.request.QueryRequest
类名称:QueryRequest
方法名:process
暂无
代码示例来源:origin: apache/nifi
private String getFieldNameOfUniqueKey() {
final SolrQuery solrQuery = new SolrQuery();
try {
solrQuery.setRequestHandler("/schema/uniquekey");
final QueryRequest req = new QueryRequest(solrQuery);
if (isBasicAuthEnabled()) {
req.setBasicAuthCredentials(getUsername(), getPassword());
}
return(req.process(getSolrClient()).getResponse().get("uniqueKey").toString());
} catch (SolrServerException | IOException e) {
getLogger().error("Solr query to retrieve uniqueKey-field failed due to {}", new Object[]{solrQuery.toString(), e}, e);
throw new ProcessException(e);
}
}
代码示例来源:origin: apache/nifi
final QueryResponse response = req.process(getSolrClient());
final SolrDocumentList documentList = response.getResults();
代码示例来源:origin: apache/nifi
final QueryResponse response = req.process(getSolrClient());
timer.stop();
代码示例来源:origin: org.pageseeder.flint/pso-flint-solr
public QueryResponse request(QueryRequest request) {
try {
return request.process(this._client, this._collection);
} catch (SolrServerException | IOException ex) {
LOGGER.error("Failed to run query request {}", request, ex);
}
return null;
}
代码示例来源:origin: com.hynnet/solr-solrj
/**
* Performs a query to the Solr server
*
* @param collection the Solr collection to query
* @param params an object holding all key/value parameters to send along the request
*
* @return a {@link org.apache.solr.client.solrj.response.QueryResponse} containing the response
* from the server
*
* @throws IOException If there is a low-level I/O error.
* @throws SolrServerException if there is an error on the server
*/
public QueryResponse query(String collection, SolrParams params) throws SolrServerException, IOException {
return new QueryRequest(params).process(this, collection);
}
代码示例来源:origin: org.apache.solr/solr-solrj
/**
* Performs a query to the Solr server
*
* @param collection the Solr collection to query
* @param params an object holding all key/value parameters to send along the request
*
* @return a {@link org.apache.solr.client.solrj.response.QueryResponse} containing the response
* from the server
*
* @throws IOException If there is a low-level I/O error.
* @throws SolrServerException if there is an error on the server
*/
public QueryResponse query(String collection, SolrParams params) throws SolrServerException, IOException {
return new QueryRequest(params).process(this, collection);
}
代码示例来源:origin: org.apache.solr/solr-solrj
/**
* Performs a query to the Solr server
*
* @param collection the Solr collection to query
* @param params an object holding all key/value parameters to send along the request
* @param method specifies the HTTP method to use for the request, such as GET or POST
*
* @return a {@link org.apache.solr.client.solrj.response.QueryResponse} containing the response
* from the server
*
* @throws IOException If there is a low-level I/O error.
* @throws SolrServerException if there is an error on the server
*/
public QueryResponse query(String collection, SolrParams params, METHOD method) throws SolrServerException, IOException {
return new QueryRequest(params, method).process(this, collection);
}
代码示例来源:origin: org.dspace.dependencies.solr/dspace-solr-solrj
public QueryResponse query(SolrParams params) throws SolrServerException {
return new QueryRequest( params ).process( this );
}
代码示例来源:origin: org.dspace.dependencies.solr/dspace-solr-solrj
public QueryResponse query(SolrParams params, METHOD method) throws SolrServerException {
return new QueryRequest( params, method ).process( this );
}
代码示例来源:origin: com.hynnet/solr-solrj
/**
* Performs a query to the Solr server
*
* @param collection the Solr collection to query
* @param params an object holding all key/value parameters to send along the request
* @param method specifies the HTTP method to use for the request, such as GET or POST
*
* @return a {@link org.apache.solr.client.solrj.response.QueryResponse} containing the response
* from the server
*
* @throws IOException If there is a low-level I/O error.
* @throws SolrServerException if there is an error on the server
*/
public QueryResponse query(String collection, SolrParams params, METHOD method) throws SolrServerException, IOException {
return new QueryRequest(params, method).process(this, collection);
}
代码示例来源:origin: org.apache.solr/solr-solrj
public void open() throws IOException {
if(cache != null) {
cloudSolrClient = cache.getCloudSolrClient(zkHost);
} else {
final List<String> hosts = new ArrayList<>();
hosts.add(zkHost);
cloudSolrClient = new CloudSolrClient.Builder(hosts, Optional.empty()).build();
}
ModifiableSolrParams params = getParams(this.props);
params.remove(SORT); //Override any sort.
Random rand = new Random();
int seed = rand.nextInt();
String sortField = "random_"+seed;
params.add(SORT, sortField+" asc");
QueryRequest request = new QueryRequest(params);
try {
QueryResponse response = request.process(cloudSolrClient, collection);
SolrDocumentList docs = response.getResults();
documentIterator = docs.iterator();
} catch (Exception e) {
throw new IOException(e);
}
}
代码示例来源:origin: org.apache.solr/solr-solrj
public NamedList<Double> call() throws Exception {
ModifiableSolrParams params = new ModifiableSolrParams();
HttpSolrClient solrClient = cache.getHttpSolrClient(baseUrl);
params.add(DISTRIB, "false");
params.add("fq","{!significantTerms}");
for(String key : paramsMap.keySet()) {
params.add(key, paramsMap.get(key));
}
params.add("minDocFreq", Float.toString(minDocFreq));
params.add("maxDocFreq", Float.toString(maxDocFreq));
params.add("minTermLength", Integer.toString(minTermLength));
params.add("field", field);
params.add("numTerms", String.valueOf(numTerms*5));
QueryRequest request= new QueryRequest(params);
QueryResponse response = request.process(solrClient);
NamedList res = response.getResponse();
return res;
}
}
代码示例来源:origin: org.apache.solr/solr-solrj
public NamedList<Double> call() throws Exception {
ModifiableSolrParams params = new ModifiableSolrParams();
HttpSolrClient solrClient = cache.getHttpSolrClient(baseUrl);
params.add(DISTRIB, "false");
params.add("fq","{!igain}");
for(String key : paramsMap.keySet()) {
params.add(key, paramsMap.get(key));
}
params.add("outcome", outcome);
params.add("positiveLabel", Integer.toString(positiveLabel));
params.add("field", field);
params.add("numTerms", String.valueOf(numTerms));
QueryRequest request= new QueryRequest(params);
QueryResponse response = request.process(solrClient);
NamedList res = response.getResponse();
return res;
}
}
代码示例来源:origin: org.apache.solr/solr-solrj
/**
* Query solr, and stream the results. Unlike the standard query, this will
* send events for each Document rather then add them to the QueryResponse.
*
* Although this function returns a 'QueryResponse' it should be used with care
* since it excludes anything that was passed to callback. Also note that
* future version may pass even more info to the callback and may not return
* the results in the QueryResponse.
*
* @param collection the Solr collection to query
* @param params an object holding all key/value parameters to send along the request
* @param callback the callback to stream results to
*
* @return a {@link org.apache.solr.client.solrj.response.QueryResponse} containing the response
* from the server
*
* @throws IOException If there is a low-level I/O error.
* @throws SolrServerException if there is an error on the server
*
* @since solr 5.1
*/
public QueryResponse queryAndStreamResponse(String collection, SolrParams params, StreamingResponseCallback callback)
throws SolrServerException, IOException {
ResponseParser parser = new StreamingBinaryResponseParser(callback);
QueryRequest req = new QueryRequest(params);
req.setStreamingResponseCallback(callback);
req.setResponseParser(parser);
return req.process(this, collection);
}
代码示例来源:origin: org.apache.solr/solr-solrj
public void open() throws IOException {
cloudSolrClient = cache.getCloudSolrClient(zkHost);
ModifiableSolrParams params = getParams(this.props);
StringBuilder builder = new StringBuilder();
for(String key : mltParams) {
if(params.get(key) != null) {
builder.append(" " + key + "=" + params.get(key));
params.remove(key);
}
}
String k = params.get("k");
if(k != null) {
params.add(ROWS, k);
params.remove(k);
}
params.add(Q, "{!mlt"+builder.toString()+"}"+id);
QueryRequest request = new QueryRequest(params);
try {
QueryResponse response = request.process(cloudSolrClient, collection);
SolrDocumentList docs = response.getResults();
documentIterator = docs.iterator();
} catch (Exception e) {
throw new IOException(e);
}
}
代码示例来源:origin: com.hynnet/solr-solrj
/**
* Query solr, and stream the results. Unlike the standard query, this will
* send events for each Document rather then add them to the QueryResponse.
*
* Although this function returns a 'QueryResponse' it should be used with care
* since it excludes anything that was passed to callback. Also note that
* future version may pass even more info to the callback and may not return
* the results in the QueryResponse.
*
* @param collection the Solr collection to query
* @param params an object holding all key/value parameters to send along the request
* @param callback the callback to stream results to
*
* @return a {@link org.apache.solr.client.solrj.response.QueryResponse} containing the response
* from the server
*
* @throws IOException If there is a low-level I/O error.
* @throws SolrServerException if there is an error on the server
*
* @since solr 5.1
*/
public QueryResponse queryAndStreamResponse(String collection, SolrParams params, StreamingResponseCallback callback)
throws SolrServerException, IOException {
ResponseParser parser = new StreamingBinaryResponseParser(callback);
QueryRequest req = new QueryRequest(params);
req.setStreamingResponseCallback(callback);
req.setResponseParser(parser);
return req.process(this, collection);
}
代码示例来源:origin: org.apache.solr/solr-solrj
QueryResponse response = request.process(solrClient);
NamedList res = response.getResponse();
代码示例来源:origin: org.apache.nifi/nifi-solr-processors
private String getFieldNameOfUniqueKey() {
final SolrQuery solrQuery = new SolrQuery();
try {
solrQuery.setRequestHandler("/schema/uniquekey");
final QueryRequest req = new QueryRequest(solrQuery);
if (isBasicAuthEnabled()) {
req.setBasicAuthCredentials(getUsername(), getPassword());
}
return(req.process(getSolrClient()).getResponse().get("uniqueKey").toString());
} catch (SolrServerException | IOException e) {
getLogger().error("Solr query to retrieve uniqueKey-field failed due to {}", new Object[]{solrQuery.toString(), e}, e);
throw new ProcessException(e);
}
}
代码示例来源:origin: org.apache.nifi/nifi-solr-processors
final QueryResponse response = req.process(getSolrClient());
final SolrDocumentList documentList = response.getResults();
代码示例来源:origin: org.apache.nifi/nifi-solr-processors
final QueryResponse response = req.process(getSolrClient());
timer.stop();
内容来源于网络,如有侵权,请联系作者删除!