mirror of
https://github.com/apache/lucene.git
synced 2025-03-06 16:29:30 +00:00
SOLR-6787 refactored a method out
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1646418 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
84e6519950
commit
9ac8383fb7
@ -101,12 +101,11 @@ public class BlobHandler extends RequestHandlerBase implements PluginInfoInitia
|
||||
TopDocs duplicate = req.getSearcher().search(new TermQuery(new Term("id", md5)), 1);
|
||||
if(duplicate.totalHits >0){
|
||||
rsp.add("error", "duplicate entry");
|
||||
SolrParams solrParams = new MapSolrParams((Map) ZkNodeProps.makeMap(
|
||||
req.forward(null,
|
||||
new MapSolrParams((Map) makeMap(
|
||||
"q", "id:" + md5,
|
||||
"fl", "id,size,version,timestamp,blobName"));
|
||||
try(LocalSolrQueryRequest r = new LocalSolrQueryRequest(req.getCore(), solrParams)) {
|
||||
req.getCore().getRequestHandler(null).handleRequest(r, rsp);
|
||||
}
|
||||
"fl", "id,size,version,timestamp,blobName")),
|
||||
rsp);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -178,13 +177,12 @@ public class BlobHandler extends RequestHandlerBase implements PluginInfoInitia
|
||||
if (blobName != null) q = "blobName" + ":" + blobName;
|
||||
if (version > -1) q += " AND version:" + version;
|
||||
|
||||
SolrParams args = new MapSolrParams((Map) ZkNodeProps.makeMap(
|
||||
"q", q,
|
||||
"fl", "id,size,version,timestamp,blobName",
|
||||
"sort", "version desc"));
|
||||
try (LocalSolrQueryRequest r = new LocalSolrQueryRequest(req.getCore(), args)){
|
||||
req.getCore().getRequestHandler(null).handleRequest(r, rsp);
|
||||
}
|
||||
req.forward(null,
|
||||
new MapSolrParams((Map) makeMap(
|
||||
"q", q,
|
||||
"fl", "id,size,version,timestamp,blobName",
|
||||
"sort", "version desc"))
|
||||
,rsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package org.apache.solr.request;
|
||||
|
||||
import org.apache.solr.response.SolrQueryResponse;
|
||||
import org.apache.solr.search.SolrIndexSearcher;
|
||||
import org.apache.solr.schema.IndexSchema;
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
@ -82,6 +83,13 @@ public interface SolrQueryRequest {
|
||||
* Suitable for logging.
|
||||
*/
|
||||
public String getParamString();
|
||||
|
||||
/** Forward the request to another handler. DO a return after this call if
|
||||
* no other operations need to be performed
|
||||
* @param handler the name of the handler
|
||||
* @param params The new set of parameter
|
||||
*/
|
||||
public void forward(String handler, SolrParams params, SolrQueryResponse rsp);
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package org.apache.solr.request;
|
||||
|
||||
import org.apache.solr.response.SolrQueryResponse;
|
||||
import org.apache.solr.search.SolrIndexSearcher;
|
||||
import org.apache.solr.util.RefCounted;
|
||||
import org.apache.solr.schema.IndexSchema;
|
||||
@ -151,4 +152,12 @@ public abstract class SolrQueryRequestBase implements SolrQueryRequest, Closeabl
|
||||
return this.getClass().getSimpleName() + '{' + params + '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forward(String handler ,SolrParams params, SolrQueryResponse rsp){
|
||||
try(LocalSolrQueryRequest r = new LocalSolrQueryRequest(getCore(), params)) {
|
||||
getCore().getRequestHandler(handler).handleRequest(r, rsp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user