|
|
@ -218,38 +218,35 @@ public class select {
|
|
|
|
// do the solr request, generate facets if we use a special YaCy format
|
|
|
|
// do the solr request, generate facets if we use a special YaCy format
|
|
|
|
SolrParams params = post.toSolrParams(/*responseWriter instanceof JsonResponseWriter ? new YaCySchema[]{YaCySchema.host_s, YaCySchema.url_file_ext_s, YaCySchema.url_protocol_s} :*/ null);
|
|
|
|
SolrParams params = post.toSolrParams(/*responseWriter instanceof JsonResponseWriter ? new YaCySchema[]{YaCySchema.host_s, YaCySchema.url_file_ext_s, YaCySchema.url_protocol_s} :*/ null);
|
|
|
|
SolrQueryRequest req = connector.request(params);
|
|
|
|
SolrQueryRequest req = connector.request(params);
|
|
|
|
|
|
|
|
Writer ow = null;
|
|
|
|
SolrQueryResponse response = null;
|
|
|
|
SolrQueryResponse response = null;
|
|
|
|
Exception e = null;
|
|
|
|
try {
|
|
|
|
try {response = connector.query(req);} catch (final SolrException ee) {e = ee;}
|
|
|
|
response = connector.query(req);
|
|
|
|
if (response != null) e = response.getException();
|
|
|
|
if (response != null) {
|
|
|
|
|
|
|
|
Exception e = response.getException();
|
|
|
|
if (e != null) {
|
|
|
|
if (e != null) {
|
|
|
|
ConcurrentLog.logException(e);
|
|
|
|
ConcurrentLog.logException(e);
|
|
|
|
if (req != null) req.close();
|
|
|
|
} else {
|
|
|
|
SolrRequestInfo.clearRequestInfo();
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// write the result directly to the output stream
|
|
|
|
// write the result directly to the output stream
|
|
|
|
if (responseWriter instanceof BinaryResponseWriter) {
|
|
|
|
if (responseWriter instanceof BinaryResponseWriter) {
|
|
|
|
try {
|
|
|
|
|
|
|
|
((BinaryResponseWriter) responseWriter).write(out, req, response);
|
|
|
|
((BinaryResponseWriter) responseWriter).write(out, req, response);
|
|
|
|
} catch (final IOException e1) {
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
req.close();
|
|
|
|
|
|
|
|
SolrRequestInfo.clearRequestInfo();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
Writer ow = new FastWriter(new OutputStreamWriter(out, UTF8.charset));
|
|
|
|
ow = new FastWriter(new OutputStreamWriter(out, UTF8.charset));
|
|
|
|
try {
|
|
|
|
|
|
|
|
responseWriter.write(ow, req, response);
|
|
|
|
responseWriter.write(ow, req, response);
|
|
|
|
ow.flush();
|
|
|
|
ow.flush();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (final SolrException e) {
|
|
|
|
|
|
|
|
ConcurrentLog.logException(e);
|
|
|
|
} catch (final IOException e1) {
|
|
|
|
} catch (final IOException e1) {
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
req.close();
|
|
|
|
req.close();
|
|
|
|
SolrRequestInfo.clearRequestInfo();
|
|
|
|
SolrRequestInfo.clearRequestInfo();
|
|
|
|
try {ow.close();} catch (final IOException e1) {}
|
|
|
|
if (ow != null) try {ow.close();} catch (final IOException e1) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (response == null) return null;
|
|
|
|
|
|
|
|
|
|
|
|
// log result
|
|
|
|
// log result
|
|
|
|
Object rv = response.getValues().get("response");
|
|
|
|
Object rv = response.getValues().get("response");
|
|
|
|