本文整理匯總了Java中org.apache.solr.common.params.ModifiableSolrParams.get方法的典型用法代碼示例。如果您正苦於以下問題:Java ModifiableSolrParams.get方法的具體用法?Java ModifiableSolrParams.get怎麽用?Java ModifiableSolrParams.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.solr.common.params.ModifiableSolrParams
的用法示例。
在下文中一共展示了ModifiableSolrParams.get方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: prepareGroupQueryParams
import org.apache.solr.common.params.ModifiableSolrParams; //導入方法依賴的package包/類
@Override
public void prepareGroupQueryParams(ModifiableSolrParams params) {
String pt = params.get(SpatialParams.POINT);
if (pt == null) {
return;
}
params.add(SpatialParams.POINT, pt);
params.add(CommonParams.FQ, fq);
params.add(SpatialParams.FIELD, sfield);
// Use distance from config if not available in the request
String d = params.get(SpatialParams.DISTANCE);
if (d == null) {
params.add(SpatialParams.DISTANCE, distance);
}
}
示例2: redirectToQueryHandler
import org.apache.solr.common.params.ModifiableSolrParams; //導入方法依賴的package包/類
/**
* redirects to query handler by using value of 'qt' parameter
*/
private static void redirectToQueryHandler(HttpServletRequest request, HttpServletResponse resp)
throws IOException {
ModifiableSolrParams solrQueryParameter = getSolrQueryParameter(request);
String queryHandlerPath = solrQueryParameter.get(QUERY_HANDLER_PAR_NAME, QUERY_PATH);
solrQueryParameter.remove(QUERY_HANDLER_PAR_NAME);
Map<String, String[]> parameters = toMultiMap(solrQueryParameter);
doRedirectToQueryHandler(resp, queryHandlerPath, parameters);
}
示例3: executeAndSerialize
import org.apache.solr.common.params.ModifiableSolrParams; //導入方法依賴的package包/類
public void executeAndSerialize(FulltextQuery query,
OutputStream outputStream) throws FullTextSearchException {
statsUsageService.increaseUsage(StatsUsageType.FULLTEXT);
Assert.notNull(query, "Can not execute a null query");
Assert.notNull(outputStream,
"Can not serialize into a null outputStream");
String queryString = ZipcodeNormalizer.normalize(query.getQuery(), query.getCountryCode());
query.withQuery(queryString);
try {
if (!disableLogging){
logger.info(query.toString());
}
ModifiableSolrParams params = FulltextQuerySolrHelper.parameterize(query);
CommonsHttpSolrServer server = new CommonsHttpSolrServer(solrClient
.getURL(), this.httpClient,
new OutputstreamResponseWrapper(outputStream, params
.get(Constants.OUTPUT_FORMAT_PARAMETER)));
server.query(params);
} catch (SolrServerException e) {
logger.error("Can not execute query " + FulltextQuerySolrHelper.toQueryString(query)
+ "for URL : " + solrClient.getURL() + " : "
+ e.getCause().getMessage(),e);
throw new FullTextSearchException(e.getCause().getMessage());
} catch (MalformedURLException e1) {
logger.error("The URL " + solrClient.getURL() + " is incorrect",e1);
throw new FullTextSearchException(e1);
} catch (RuntimeException e2) {
String message = e2.getCause()!=null?e2.getCause().getMessage():e2.getMessage();
logger
.error("An error has occurred during fulltext search of query "
+ query + " : " + message,e2);
throw new FullTextSearchException(message,e2);
}
}
示例4: deleteSnapshot
import org.apache.solr.common.params.ModifiableSolrParams; //導入方法依賴的package包/類
private void deleteSnapshot(ModifiableSolrParams params, SolrQueryResponse rsp, SolrQueryRequest req) {
String name = params.get("name");
if(name == null) {
throw new SolrException(ErrorCode.BAD_REQUEST, "Missing mandatory param: name");
}
SnapShooter snapShooter = new SnapShooter(core, params.get("location"), params.get("name"));
snapShooter.validateDeleteSnapshot();
snapShooter.deleteSnapAsync(this);
}
示例5: handleRequestBody
import org.apache.solr.common.params.ModifiableSolrParams; //導入方法依賴的package包/類
@Override
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
LOGGER.debug("Handling request {}", req);
final ModifiableSolrParams modifiableSolrParams = new ModifiableSolrParams(req.getParams());
final String originQuery = modifiableSolrParams.get(CommonParams.Q);
final long[] startAndEnd = dateRangeParser.getNumericQueryTerms(originQuery);
final long queryStart = or(startAndEnd[0], -1L, 0L);
final long queryEnd = or(startAndEnd[1], -1L, Long.MAX_VALUE);
modifiableSolrParams.set(ChronixQueryParams.QUERY_START_LONG, String.valueOf(queryStart));
modifiableSolrParams.set(ChronixQueryParams.QUERY_END_LONG, String.valueOf(queryEnd));
final String query = dateRangeParser.replaceRangeQueryTerms(originQuery);
modifiableSolrParams.set(CommonParams.Q, query);
//Set the min required fields if the user define a sub set of fields
final String fields = modifiableSolrParams.get(CommonParams.FL);
modifiableSolrParams.set(CommonParams.FL, requestedFields(fields, req.getSchema().getFields().keySet()));
//Set the updated query
req.setParams(modifiableSolrParams);
//check the filter queries
final String[] chronixFunctions = modifiableSolrParams.getParams(ChronixQueryParams.CHRONIX_FUNCTION);
final String chronixJoin = modifiableSolrParams.get(ChronixQueryParams.CHRONIX_JOIN);
//if we have an function query or someone wants the data as json
if (arrayIsNotEmpty(chronixFunctions) || contains(ChronixQueryParams.DATA_AS_JSON, fields) || !StringUtils.isEmpty(chronixJoin)) {
LOGGER.debug("Request is an analysis request.");
analysisHandler.handleRequestBody(req, rsp);
} else {
//let the default search handler do its work
LOGGER.debug("Request is a default request");
searchHandler.handleRequestBody(req, rsp);
}
//add the converted start and end to the response
rsp.getResponseHeader().add(ChronixQueryParams.QUERY_START_LONG, queryStart);
rsp.getResponseHeader().add(ChronixQueryParams.QUERY_END_LONG, queryEnd);
}
示例6: queryPartialResults
import org.apache.solr.common.params.ModifiableSolrParams; //導入方法依賴的package包/類
protected void queryPartialResults(final List<String> upShards,
final List<SolrServer> upClients,
Object... q) throws Exception {
final ModifiableSolrParams params = new ModifiableSolrParams();
for (int i = 0; i < q.length; i += 2) {
params.add(q[i].toString(), q[i + 1].toString());
}
// TODO: look into why passing true causes fails
params.set("distrib", "false");
final QueryResponse controlRsp = controlClient.query(params);
// if time.allowed is specified then even a control response can return a partialResults header
if (params.get(CommonParams.TIME_ALLOWED) == null) {
validateControlData(controlRsp);
}
params.remove("distrib");
setDistributedParams(params);
QueryResponse rsp = queryRandomUpServer(params,upClients);
comparePartialResponses(rsp, controlRsp, upShards);
if (stress > 0) {
log.info("starting stress...");
Thread[] threads = new Thread[nThreads];
for (int i = 0; i < threads.length; i++) {
threads[i] = new Thread() {
@Override
public void run() {
for (int j = 0; j < stress; j++) {
int which = r.nextInt(upClients.size());
SolrServer client = upClients.get(which);
try {
QueryResponse rsp = client.query(new ModifiableSolrParams(params));
if (verifyStress) {
comparePartialResponses(rsp, controlRsp, upShards);
}
} catch (SolrServerException e) {
throw new RuntimeException(e);
}
}
}
};
threads[i].start();
}
for (Thread thread : threads) {
thread.join();
}
}
}