Skip to content

Commit

Permalink
Envia para Solr parâmetros adicionais de filtros (ex. sort e limit). #2
Browse files Browse the repository at this point in the history
  • Loading branch information
viniciusandrade committed Oct 22, 2020
1 parent c0243a5 commit c67ed57
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Binary file not shown.
17 changes: 15 additions & 2 deletions src/java/org/bireme/dia/controller/DIAServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.io.*;
import java.net.*;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.ResourceBundle;
Expand Down Expand Up @@ -126,8 +127,9 @@ private void processSearch(HttpServletRequest request, HttpServletResponse respo
String queryType = this.identifyQueryType(request);
Map<String,String> queryMap = new LinkedHashMap<String,String>();

Map request_params = request.getParameterMap();

queryMap.put("qt", queryType); //set the query type

// make query parameter
if (q != null && q.equals("") == false) {
queryFormatted = this.formatQuery(q);
Expand Down Expand Up @@ -190,8 +192,19 @@ private void processSearch(HttpServletRequest request, HttpServletResponse respo
facet_index++;
// hashmap dont allow duplicated keys
// add special name for parameter array (facet.field%1)
queryMap.put("facet.field%" + facet_index, facet);
queryMap.put("facet.field%" + facet_index, facet);
}
// check request for additional facet sort param (ex. sort)
Iterator i = request_params.keySet().iterator();
String facet_sort_param = "f.";
while ( i.hasNext() ){
String key = (String) i.next();
String value = request.getParameter(key);

if (key.contains(facet_sort_param)){
queryMap.put(key, value);
}
}
}

//System.out.println("query final: " + queryMap.toString());
Expand Down

0 comments on commit c67ed57

Please sign in to comment.