summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorsgaebel <sgaebel@localhost.localdomain>2021-03-20 16:29:16 +0100
committersgaebel <sgaebel@localhost.localdomain>2021-03-20 17:48:26 +0100
commit93b353d22def2c26dfe48db9c48a3528a64497ed (patch)
tree304da91a0c036fb357324b3e9458f9fbdf126b58 /source
parentf16cd154f7d39e42e2669e6a46cbbd4b589a561f (diff)
does not boost or add fields for zero-row-queries (exists())
Diffstat (limited to 'source')
-rw-r--r--source/net/yacy/http/servlets/SolrSelectServlet.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/net/yacy/http/servlets/SolrSelectServlet.java b/source/net/yacy/http/servlets/SolrSelectServlet.java
index 736cbc07b..25a87b683 100644
--- a/source/net/yacy/http/servlets/SolrSelectServlet.java
+++ b/source/net/yacy/http/servlets/SolrSelectServlet.java
@@ -181,10 +181,11 @@ public class SolrSelectServlet extends HttpServlet {
mmsp.getMap().put(CommonParams.ROWS, new String[]{Integer.toString(maximumRecords)}); // sru patch
}
mmsp.getMap().put(CommonParams.ROWS, new String[]{Integer.toString(Math.min(mmsp.getInt(CommonParams.ROWS, CommonParams.ROWS_DEFAULT), (authenticated) ? 100000000 : 100))});
+ boolean zeroDoc = mmsp.getInt(CommonParams.ROWS, CommonParams.ROWS_DEFAULT) < 1;
// set ranking according to profile number if ranking attributes are not given in the request
Ranking ranking = sb.index.fulltext().getDefaultConfiguration().getRanking(profileNr);
- if (!mmsp.getMap().containsKey(CommonParams.SORT) && !mmsp.getMap().containsKey(DisMaxParams.BQ) && !mmsp.getMap().containsKey(DisMaxParams.BF) && !mmsp.getMap().containsKey("boost")) {
+ if (!zeroDoc && !mmsp.getMap().containsKey(CommonParams.SORT) && !mmsp.getMap().containsKey(DisMaxParams.BQ) && !mmsp.getMap().containsKey(DisMaxParams.BF) && !mmsp.getMap().containsKey("boost")) {
if (!mmsp.getMap().containsKey("defType")) mmsp.getMap().put("defType", new String[]{"edismax"});
String fq = ranking.getFilterQuery();
String bq = ranking.getBoostQuery();
@@ -208,7 +209,7 @@ public class SolrSelectServlet extends HttpServlet {
}
// if this is a call to YaCys special search formats, enhance the query with field assignments
- if ((responseWriter instanceof YJsonResponseWriter || responseWriter instanceof OpensearchResponseWriter) && "true".equals(mmsp.get("hl", "true"))) {
+ if (!zeroDoc && (responseWriter instanceof YJsonResponseWriter || responseWriter instanceof OpensearchResponseWriter) && "true".equals(mmsp.get("hl", "true"))) {
// add options for snippet generation
if (!mmsp.getMap().containsKey("hl.q")) mmsp.getMap().put("hl.q", new String[]{q});
if (!mmsp.getMap().containsKey("hl.fl")) mmsp.getMap().put("hl.fl", new String[]{CollectionSchema.description_txt.getSolrFieldName() + "," + CollectionSchema.h4_txt.getSolrFieldName() + "," + CollectionSchema.h3_txt.getSolrFieldName() + "," + CollectionSchema.h2_txt.getSolrFieldName() + "," + CollectionSchema.h1_txt.getSolrFieldName() + "," + CollectionSchema.text_t.getSolrFieldName()});