<commit_before>{#
The search form for dataset search
#}

{% import 'macros/form.html' as form %}
{% resource 'bootstrap-switch/bootstrap-switch.js' %}
{% resource 'bootstrap-switch/bootstrap-switch.css' %}
{% resource 'eaw_theme/andorswitch.js' %}
{% resource 'eaw_theme/eaw_theme_hidewithjs.js' %}
{% resource 'eaw_vocabularies/eaw_vocabularies_daterange_info.js' %}

<h3>{{ _('Filter Datasets') }}</h3>
{% if form_id is not defined %}
  {% set form_id="dataset-search-form" %}
{% endif %}

{% block errors %}{{ form.errors(search_error) }}{% endblock %}

<form id="{{ form_id }}"
      class="form-inline {% if no_bottom_border %} no-bottom-border{% endif %} search-form"
      method="get" data-module="select-switch"
      data-module-target="select">  
      {%- set clear_url =  h.url_for(controller='package', action='search') %}

      {# Variables #}
      {%- set taglist_variables=h.eaw_taglist("variables") %}
      {%- set select = c.fields_grouped['variables'] %}
      {%- set id = "field-variables"%}
      {%- set name = "variables" %}
      {%- set title = _('Variables') %}
      {%- set placeholder = 'eg. %(tag1)s, %(tag2)s, %(tag3)s, ...'
      |format(tag1=taglist_variables[0].value,tag2=taglist_variables[1].value,
      tag3=taglist_variables[2].value) %}
      {% set attrs = 'multiple="multiple" '  ~ 'data-module="autocomplete" ' ~
      'placeholder="' ~ placeholder ~'"'  %}
      {% set selected = c.fields_grouped['OP_variables']|first %}
      <h4 class="h4searchlabel">{{ title }}</h4>
      <div>
	<select class="filterselect" id="{{ id }}" name="{{ name }}" {{ attrs|safe }}>
	  {% for option in taglist_variables %}
            <option value="{{ option.value }}"{% if option.value in select %}
		    selected="selected"{% endif %}>{{ option.text or option.value }}</option>
		  {% endfor %}
	</select>
	
	<input type="checkbox" onchange="$( '#{{ form_id }}' ).submit();"
	       id="and-or" name="OP_variables" data-module="andorswitch"
	       value="OR" {% if selected == "OR" %}checked="checked"{% endif %} />
	<label class="checkbox">
	  <span class="js-hide">find ANY</span>
	</label>
      </div>

      {# Systems #}
      {%- set taglist_variables=h.eaw_taglist("systems") %}
      {%- set select = c.fields_grouped['systems'] %}
      {%- set id = "field-systems"%}
      {%- set name = "systems" %}
      {%- set title = _('Systems') %}
      {%- set placeholder = 'eg. %(tag1)s, %(tag2)s, %(tag3)s, ...'
      |format(tag1=taglist_variables[0].value,tag2=taglist_variables[1].value,
      tag3=taglist_variables[2].value) %}
      {%- set attrs = 'multiple="multiple" '  ~ 'data-module="autocomplete" ' ~
      'placeholder="' ~ placeholder ~'"'  %}
      {%- set selected = c.fields_grouped['OP_systems']|first %}
      <h4 class="h4searchlabel">{{ title }}</h4>
      <div>
	<select class="filterselect" id="{{ id }}" name="{{ name }}" {{ attrs|safe }}>
	  {% for option in taglist_variables %}
            <option value="{{ option.value }}"{% if option.value in select %}
		    selected="selected"{% endif %}>{{ option.text or option.value }}</option>
		  {% endfor %}
	</select>
	
	  <input type="checkbox" onchange="$( '#{{form_id }}' ).submit();"
		 id="and-or" name="OP_systems" data-module="andorswitch"
		 value="OR" {% if selected == "OR" %}checked="checked"{% endif %} />
	  <label class="checkbox">
	    <span class="js-hide">find ANY</span>
	  </label>
      </div>

      {# Time range #}
      {% set timestartval = c.fields_grouped['timestart'] %}
      {% set timeendval = c.fields_grouped['timeend'] %} 
      {%- set title = _('Time(-Range)') %}

      <div style="float:left;margin-right:5px;">
	<h4 class="h4searchlabel">Time-Start</h4>
	<div class="search-input">
	  <input style="width:24ex;" type="text" id="time-start" name="timestart" value="{{ timestartval }}"/>
	</div>
      </div>
      <div style="float:left;margin-right:5px;">
	<h4 class="h4searchlabel">Time-End</h4>
	<div class="search-input">
	  <input style="width:24ex" type="text" id="time-end" name="timeend" value="{{ timeendval }}"/>
	  <button type="submit" value="search" class="outsidebutton"> 
	    <i class="icon-search"></i>   
	    <span>{{ _('Search') }}</span>   
	  </button>
	  <button  type="button" class="outsidebutton second"
		   data-module="eaw_vocabularies_daterange_info"
		   data-module-target="#timerangehelp">
		   <i class="icon-info-sign"></i>
	  </button>
	</div>
      </div>

      {% snippet 'package/snippets/timerangehelp-modal.html' %}
      
      <p style="clear:both;"></p>
      
      <div style="width:100%px;background:red;position:relative;">
	<div style="position:absolute;right:0px;">
	     {# <div class="btn-group" role="group"> #}
	  {# <a class="btn clear-form-button" href={{ clear_url }}> #}
	  <a class="btn" href={{ clear_url }}>
		 <i class="icon-ban-circle"></i>
		 {{ _('Clear') }}
	       </a>
	       <button class="btn js-hide hidden_submit_btn" type="submit">
		 <i class="icon-search"></i>
		 {{ _('Filter') }}
	       </button>
	     {# </div> #}
	</div>
      </div>
      
      <ul class="nav nav-pills advsearchbutton" data-module="eaw_theme_hidewithjs"
	  data-module-target="#advancedsearch">
	  <li><a href="#">{{ _('Advanced Search') }} <span class="caret"></span></a></li>
      </ul>
      <p>
	<div id="advancedsearch" class="togglesearch search-geant search-input control-group">
	  <div class="presearchboxtext">
	    <h4> Advanced Search</h4>
	    You can use the <a target="_blank"
	    href="https://cwiki.apache.org/confluence/display/solr/The+Standard+Query+Parser">
	    Solr query syntax</a> here. For starters, just type any term to
	    search for it across all fields in all packages.
	    <div class="search-input">
	      <input type="text" class="search" name="q" value="{{ query }}"   
    		     autocomplete="off" placeholder="type query ...">   
		     <button type="submit" value="search" tabindex=0>   
		       <i class="icon-search"></i>   
		       <span>{{ _('Search') }}</span>   
		     </button>   
	    </div>
	  </div>
	</div>
      </p>

  {% block search_search_fields %}  
  {% if facet_fields -%}    
    <span>{{ form.hidden_from_list(fields=facet_fields) }}</span>    
  {%- endif %}    
  {% endblock %}  
  
 
  <div class="form-select control-group control-order-by ">
    {% if sorting %}
    <label for="field-order-by">{{ _('Order by') }}</label>
    <select id="field-order-by" name="sort">
        {% for label, value in sorting %}
          {%- if label and value %}
            <option value="{{ value }}" {%- if sorting_selected == value %}
		    selected="selected"{%- endif %}>{{ label }}
	    </option>
          {% endif %}
        {% endfor %}
    </select>
    {% endif %}
  </div>

  {% block search_title %}
    {% if not no_title %}
      <h2>{% snippet 'snippets/search_result_text.html', query=query, count=count, type=type %}</h2>
    {% endif %}
  {% endblock %}

  {% block search_facets %}
    {% set facet_names = h.eaw_get_facetnames() %}
    {% if facet_names %}
      <p class="filter-list">
        {% for field in facet_names %}
          {% set search_facets_items = facets.search.get(field)['items'] %}
          <span class="facet">{{ facets.titles.get(field) }}:</span>
          {% for value in facets.fields[field] %}
            <span class="filtered pill">
              {%- if facets.translated_fields and facets.translated_fields.has_key((field,value)) -%}
                {{ facets.translated_fields[(field,value)] }}
              {%- else -%}
                {{ h.list_dict_filter(search_facets_items, 'name', 'display_name', value) }}
              {%- endif %}
              <a href="{{ facets.remove_field(field, value) }}"
		 class="remove" title="{{ _('Remove') }}">
		 <i class="icon-remove"></i></a>
            </span>
          {% endfor %}
        {% endfor %}
      </p>     
      <a class="show-filters btn">{{ _('Filter Results') }}</a>
    {% endif %}
  {% endblock %}
</form>

{% if show_empty and count == 0 %}
  {% trans %}
    <p class="extra">Please try another search.</p>
  {% endtrans %}
{% endif %}

{% if error %}
  {% trans %}
    <p><strong>There was an error while searching.</strong> Please try again.</p>
  {% endtrans %}
{% endif %}

<commit_msg>filter, clear buttons ok<commit_after>{#
The search form for dataset search
#}

{% import 'macros/form.html' as form %}
{% resource 'bootstrap-switch/bootstrap-switch.js' %}
{% resource 'bootstrap-switch/bootstrap-switch.css' %}
{% resource 'eaw_theme/andorswitch.js' %}
{% resource 'eaw_theme/eaw_theme_hidewithjs.js' %}
{% resource 'eaw_vocabularies/eaw_vocabularies_daterange_info.js' %}

<h3>{{ _('Filter Datasets') }}</h3>
{% if form_id is not defined %}
  {% set form_id="dataset-search-form" %}
{% endif %}

{% block errors %}{{ form.errors(search_error) }}{% endblock %}

<form id="{{ form_id }}"
      class="form-inline {% if no_bottom_border %} no-bottom-border{% endif %} search-form"
      method="get" data-module="select-switch"
      data-module-target="select">  
      {%- set clear_url =  h.url_for(controller='package', action='search') %}

      {# Variables #}
      {%- set taglist_variables=h.eaw_taglist("variables") %}
      {%- set select = c.fields_grouped['variables'] %}
      {%- set id = "field-variables"%}
      {%- set name = "variables" %}
      {%- set title = _('Variables') %}
      {%- set placeholder = 'eg. %(tag1)s, %(tag2)s, %(tag3)s, ...'
      |format(tag1=taglist_variables[0].value,tag2=taglist_variables[1].value,
      tag3=taglist_variables[2].value) %}
      {% set attrs = 'multiple="multiple" '  ~ 'data-module="autocomplete" ' ~
      'placeholder="' ~ placeholder ~'"'  %}
      {% set selected = c.fields_grouped['OP_variables']|first %}
      <h4 class="h4searchlabel">{{ title }}</h4>
      <div>
	<select class="filterselect" id="{{ id }}" name="{{ name }}" {{ attrs|safe }}>
	  {% for option in taglist_variables %}
            <option value="{{ option.value }}"{% if option.value in select %}
		    selected="selected"{% endif %}>{{ option.text or option.value }}</option>
		  {% endfor %}
	</select>
	
	<input type="checkbox" onchange="$( '#{{ form_id }}' ).submit();"
	       id="and-or" name="OP_variables" data-module="andorswitch"
	       value="OR" {% if selected == "OR" %}checked="checked"{% endif %} />
	<label class="checkbox">
	  <span class="js-hide">find ANY</span>
	</label>
      </div>

      {# Systems #}
      {%- set taglist_variables=h.eaw_taglist("systems") %}
      {%- set select = c.fields_grouped['systems'] %}
      {%- set id = "field-systems"%}
      {%- set name = "systems" %}
      {%- set title = _('Systems') %}
      {%- set placeholder = 'eg. %(tag1)s, %(tag2)s, %(tag3)s, ...'
      |format(tag1=taglist_variables[0].value,tag2=taglist_variables[1].value,
      tag3=taglist_variables[2].value) %}
      {%- set attrs = 'multiple="multiple" '  ~ 'data-module="autocomplete" ' ~
      'placeholder="' ~ placeholder ~'"'  %}
      {%- set selected = c.fields_grouped['OP_systems']|first %}
      <h4 class="h4searchlabel">{{ title }}</h4>
      <div>
	<select class="filterselect" id="{{ id }}" name="{{ name }}" {{ attrs|safe }}>
	  {% for option in taglist_variables %}
            <option value="{{ option.value }}"{% if option.value in select %}
		    selected="selected"{% endif %}>{{ option.text or option.value }}</option>
		  {% endfor %}
	</select>
	
	  <input type="checkbox" onchange="$( '#{{form_id }}' ).submit();"
		 id="and-or" name="OP_systems" data-module="andorswitch"
		 value="OR" {% if selected == "OR" %}checked="checked"{% endif %} />
	  <label class="checkbox">
	    <span class="js-hide">find ANY</span>
	  </label>
      </div>

      {# Time range #}
      {% set timestartval = c.fields_grouped['timestart'] %}
      {% set timeendval = c.fields_grouped['timeend'] %} 
      {%- set title = _('Time(-Range)') %}

      <div style="float:left;margin-right:5px;">
	<h4 class="h4searchlabel">Time-Start</h4>
	<div class="search-input">
	  <input style="width:24ex;" type="text" id="time-start" name="timestart" value="{{ timestartval }}"/>
	</div>
      </div>
      <div style="float:left;margin-right:5px;">
	<h4 class="h4searchlabel">Time-End</h4>
	<div class="search-input">
	  <input style="width:24ex" type="text" id="time-end" name="timeend" value="{{ timeendval }}"/>
	  <button type="submit" value="search" class="outsidebutton"> 
	    <i class="icon-search"></i>   
	    <span>{{ _('Search') }}</span>   
	  </button>
	  <button  type="button" class="outsidebutton second"
		   data-module="eaw_vocabularies_daterange_info"
		   data-module-target="#timerangehelp">
		   <i class="icon-info-sign"></i>
	  </button>
	</div>
      </div>

      {% snippet 'package/snippets/timerangehelp-modal.html' %}
      
      <p style="clear:both;"></p>
      
      {# <div style="width:100%px;background:red;position:relative;"> #}
      {# <div style="position:absolute;right:0px;"> #} 
	     {# <div class="btn-group" role="group"> #}
      {# <a class="btn clear-form-button" href={{ clear_url }}> #}
      <div class="btn-group clear-filter-group">
        <a class="btn" type="button" href="{{ clear_url }}">
	  <i class="icon-ban-circle"></i>
	  {{ _('Clear') }}
	</a>
	<button class="btn js-hide hidden_submit_btn" type="submit">
	  <i class="icon-search"></i>
	  {{ _('Filter') }}
	</button>
      </div>
      
      <div> 
      	<ul class="nav nav-pills advsearchbutton" data-module="eaw_theme_hidewithjs"  
      	    data-module-target="#advancedsearch">  
      	    <li><a href="#">{{ _('Advanced Search') }} <span class="caret"></span></a></li>  
      	</ul>  
	<div id="advancedsearch" class="togglesearch search-geant">
      	  <div class="presearchboxtext">  
      	    <h4> Advanced Search</h4> 
      	    You can use the <a target="_blank" 
      	    href="https://cwiki.apache.org/confluence/display/solr/The+Standard+Query+Parser"> 
      	    Solr query syntax</a> here. For starters, just type any term to 
      	    search for it across all fields in all packages. 
      	    <div class="search-input"> 
      	      <input type="text" class="search" name="q" value="{{ query }}"    
      		     autocomplete="off" placeholder="type query ...">    
		     <button type="submit" value="search" class="outsidebutton"> 
		       <i class="icon-search"></i>   
		       <span>{{ _('Search') }}</span>   
		     </button>
      	    </div> 
      	  </div>  
      	</div>   
      
  {% block search_search_fields %}  
  {% if facet_fields -%}    
    <span>{{ form.hidden_from_list(fields=facet_fields) }}</span>    
  {%- endif %}    
  {% endblock %}  
  
 
  <div class="form-select control-group control-order-by ">
    {% if sorting %}
    <label for="field-order-by">{{ _('Order by') }}</label>
    <select id="field-order-by" name="sort">
        {% for label, value in sorting %}
          {%- if label and value %}
            <option value="{{ value }}" {%- if sorting_selected == value %}
		    selected="selected"{%- endif %}>{{ label }}
	    </option>
          {% endif %}
        {% endfor %}
    </select>
    {% endif %}
  </div>

  {% block search_title %}
    {% if not no_title %}
      <h2>{% snippet 'snippets/search_result_text.html', query=query, count=count, type=type %}</h2>
    {% endif %}
  {% endblock %}

  {% block search_facets %}
    {% set facet_names = h.eaw_get_facetnames() %}
    {% if facet_names %}
      <p class="filter-list">
        {% for field in facet_names %}
          {% set search_facets_items = facets.search.get(field)['items'] %}
          <span class="facet">{{ facets.titles.get(field) }}:</span>
          {% for value in facets.fields[field] %}
            <span class="filtered pill">
              {%- if facets.translated_fields and facets.translated_fields.has_key((field,value)) -%}
                {{ facets.translated_fields[(field,value)] }}
              {%- else -%}
                {{ h.list_dict_filter(search_facets_items, 'name', 'display_name', value) }}
              {%- endif %}
              <a href="{{ facets.remove_field(field, value) }}"
		 class="remove" title="{{ _('Remove') }}">
		 <i class="icon-remove"></i></a>
            </span>
          {% endfor %}
        {% endfor %}
      </p>     
      <a class="show-filters btn">{{ _('Filter Results') }}</a>
    {% endif %}
  {% endblock %}
</form>

{% if show_empty and count == 0 %}
  {% trans %}
    <p class="extra">Please try another search.</p>
  {% endtrans %}
{% endif %}

{% if error %}
  {% trans %}
    <p><strong>There was an error while searching.</strong> Please try again.</p>
  {% endtrans %}
{% endif %}


{'fraction_non_alphanumeric': 0.20208620586295786, 'fraction_numerical': 0.005695102212097596, 'mean_word_length': 2.9521440416962803, 'pattern_counts': {'":': 0, '<': 257, '<?xml version=': 0, '>': 257, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1116425', 'n_tokens_mistral': 6095, 'n_tokens_neox': 5477, 'n_words': 1086}