Skip to content

Commit

Permalink
Fix ExportCSVToFILEServlet query expansion handling (bioinformatics-u…
Browse files Browse the repository at this point in the history
…a#550)

- ignore "keyword" parameter,
  add opt-in "expand" parameter instead
- should have been exactly the same behavior as SearchServlet,
  so treat this as a bug
  • Loading branch information
Enet4 authored Dec 15, 2021
1 parent e1fe1a2 commit d11990f
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.atomic.AtomicLong;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
Expand Down Expand Up @@ -100,7 +99,6 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S
Map<String, String> fields = new HashMap<>();
String queryString = null;
String[] arr;
boolean keyword;

try {
queryString = req.getParameter("query");
Expand All @@ -121,15 +119,18 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S
fields.put(f.toString(), f.toString());
orderedFields.add(f.toString());
}
keyword = Boolean.parseBoolean(req.getParameter("keyword"));

arr = req.getParameterValues("providers");
} catch (JSONException ex) {
ResponseUtil.sendError(resp, 400, "Invalid JSON content");
return;
}

if (!keyword) {
String pExpand = req.getParameter("expand");
boolean expand = pExpand != null && (pExpand.isEmpty() || Boolean.parseBoolean(pExpand));

// perform query expansion only if requested
if (expand) {
QueryExpressionBuilder q = new QueryExpressionBuilder(queryString);
queryString = q.getQueryString();
}
Expand Down

0 comments on commit d11990f

Please sign in to comment.