Skip to content

Commit

Permalink
Fix to return button to clean querytext value
Browse files Browse the repository at this point in the history
  • Loading branch information
litvinovg committed Nov 19, 2024
1 parent b44b68b commit 8709c47
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package edu.cornell.mannlib.vitro.webapp.search.controller;

import static edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary.ROLE_PUBLIC_URI;
import static edu.cornell.mannlib.vitro.webapp.search.controller.PagedSearchController.PARAM_QUERY_TEXT;

import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -167,6 +168,9 @@ public class SearchFiltering {

protected static void addFiltersToQuery(SearchQuery query, Map<String, SearchFilter> filters) {
for (SearchFilter searchFilter : filters.values()) {
if (PARAM_QUERY_TEXT.equals(searchFilter.getId())){
continue;
}
if (searchFilter.isInput()) {
SearchFiltering.addInputFilter(query, searchFilter);
} else if (searchFilter.isRange()) {
Expand Down Expand Up @@ -221,6 +225,12 @@ public static Map<String, List<String>> getRequestFilters(VitroRequest vreq) {
requestFilters.put(filterId, new LinkedList<String>(Arrays.asList(values[0])));
}
}
if (paramFilterName.equals(PARAM_QUERY_TEXT)) {
String[] values = vreq.getParameterValues(paramFilterName);
if (values != null && values.length > 0) {
requestFilters.put(PARAM_QUERY_TEXT, new LinkedList<String>(Arrays.asList(values[0])));
}
}
}
return requestFilters;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

:filter_group_search_filters a vitro-search:FilterGroup ;
vitro-search:contains :filter_category , :filter_type , :filter_querytext;
vitro-search:contains :filter_category , :filter_type ;
vitro-search:id "main" ;
vitro-search:order 1 ;
vitro-search:public true .
Expand Down Expand Up @@ -50,6 +50,7 @@
a vitro-search:Filter ;
vitro-search:order 1 ;
vitro-search:filterField :field_querytext ;
vitro-search:userInput true ;
vitro-search:id "querytext" ;
vitro-search:public true .

Expand Down

0 comments on commit 8709c47

Please sign in to comment.