Skip to content

Commit

Permalink
Closes #2433: Fix errors in advanced search with empty bbox filters a…
Browse files Browse the repository at this point in the history
…nd back button (#2437)

* Closes #2433: Fix errors in advanced search with empty bbox filters and back button
  • Loading branch information
diasf authored Mar 21, 2024
1 parent 9fc6671 commit cd80fb5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.commons.lang3.StringUtils;
import org.omnifaces.cdi.ViewScoped;

import javax.annotation.PostConstruct;
import javax.faces.model.SelectItem;
import javax.inject.Inject;
import javax.inject.Named;
Expand Down Expand Up @@ -100,6 +101,7 @@ public AdvancedSearchPage(DataverseDao dataverseDao, DatasetFieldServiceBean dat

// -------------------- LOGIC --------------------

@PostConstruct
public void init() {
if (dataverseIdentifier != null) {
dataverse = dataverseDao.findByAlias(dataverseIdentifier);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public QueryPart getQueryPart() {
.filter(f -> StringUtils.isNotBlank(f.getSingleValue()))
.map(f -> f.getSingleValue() + f.getDatasetFieldType().getMetadata("geoboxCoord"))
.collect(Collectors.joining("|"));
if (coords.isEmpty()) {
return QueryPart.EMPTY;
}
return new QueryPart(QueryPartType.FILTER, String.format("[GEO[%s|%s]]", parent.getDatasetFieldType().getName(), coords));
}

Expand Down
1 change: 0 additions & 1 deletion dataverse-webapp/src/main/webapp/search/advanced.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<ui:define name="body">
<f:metadata>
<o:importConstants type="edu.harvard.iq.dataverse.search.advanced.SearchFieldType" var="fieldTypeEnums"/>
<f:viewAction action="#{AdvancedSearchPage.init}"/>
<f:viewParam name="dataverseIdentifier" value="#{AdvancedSearchPage.dataverseIdentifier}"/>
<f:viewAction
action="#{dataverseHeaderFragment.initBreadcrumbs(AdvancedSearchPage.dataverse, bundle['dataverse.search.advancedSearch'])}"/>
Expand Down

0 comments on commit cd80fb5

Please sign in to comment.