Skip to content

Commit

Permalink
Added habitat and collector to advanced search (configurable)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjrj committed Jul 23, 2024
1 parent 4d7af7d commit cd5bbbd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions grails-app/i18n/messages_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ advancedsearch.table10col01.title = Begin date
advancedsearch.table10col01.des = (YYYY-MM-DD) leave blank for most recent record date
advancedsearch.table10col02.title = End date
advancedsearch.table10col02.des = (YYYY-MM-DD) leave blank for most recent record date
advancedsearch.table11col01.title = Habitat
advancedsearch.dataset.col.label = Data Resource
advancedsearch.dataset.select.default = -- select a Data Resource --
advancedsearch.button.submit = Search
Expand Down
14 changes: 12 additions & 2 deletions grails-app/views/home/_advanced.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@
</div>
</g:if>

<g:if test="${request.getAttribute("collector_text") && request.getAttribute("collector_text").size() > 1}">
<div class="form-group">
<g:if test="${request.getAttribute('collector_text') || grailsApplication.config.getProperty('advancedSearchShowCollector', Boolean, false)}">
<div class="form-group">
<label class="col-md-2 control-label" for="collector_text"><g:message code="advancedsearch.collector_text.title" default="Collector"/></label>
<div class="col-md-6">
<input type="text" name="collector_text" id="collector_text" class="dataset form-control" placeholder="" value=""/>
Expand Down Expand Up @@ -221,6 +221,16 @@
</div>
</div>

<g:if test="grailsApplication.config.getProperty('advancedSearchShowHabitat', Boolean, false)}">
<div class="form-group">
<label class="col-md-2 control-label" for="habitat"><g:message code="advancedsearch.table11col01.title" default="Habitat"/></label>

<div class="col-md-6">
<input type="text" name="habitat" id="habitat" class="dataset form-control" placeholder="" value=""/>
</div>
</div>
</g:if>

<input type="submit" value="<g:message code="advancedsearch.button.submit" default="Search"/>" class="btn btn-primary" />
&nbsp;&nbsp;
<input type="reset" value="<g:message code="advancedsearch.button.clear.all" default="Clear all"/>" id="clearAll" class="btn btn-default" onclick="$('input#solrQuery').val(''); $('input.clear_taxon').click(); return true;"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class AdvancedSearchParams implements Validateable {
String start_year = ""
String end_year = ""
String collector_text = ""
String habitat = ""

private final String QUOTE = "\""
private final String BOOL_OP = "AND"
Expand Down Expand Up @@ -110,6 +111,7 @@ class AdvancedSearchParams implements Validateable {
if (duplicate_inst) queryItems.add("duplicate_inst:" + duplicate_inst)
if (state_conservation) queryItems.add("state_conservation:" + state_conservation)
if (collector_text) queryItems.add("collector_text:" + collector_text)
if (habitat) queryItems.add("habitat:" + habitat)
//if (collectors_number) queryItems.add("collector:" + collectors_number); // TODO field in SOLR not active

ArrayList<String> lsids = new ArrayList<String>()
Expand Down

0 comments on commit cd5bbbd

Please sign in to comment.