<commit_before>---
layout: front
---

<div class="container-fluid data-search">
  <div class="container">
    <div class="col-12">
      <h2>
        Find data
      </h2>
      <!--<div class="row">-->
      <template is="dom-bind">
        <script>
    			var searchIndex;
    			var findData = document.querySelector('#find-data');
    			findData.addEventListener('autocomplete-selected', onSelect);
    			findData.addEventListener('autocomplete-change', onChange);

    			function onSelect(event) {
    				var selected = event.detail.text;
    				window.location.href = event.detail.value;
    			}

    			function onChange(event) {
    				var search = event.detail.option.text.toLowerCase();
    				var searchIndexURL = "{{ settings.BASE_URL }}/searchindex.json";
    				if (!searchIndex) {
    					$.getJSON(searchIndexURL, function(data){
    						searchIndex = data;
    					})
    					return;
    				}

    				findData.suggestions(searchIndex.filter(function(obj){
    					return obj[findData.textProperty].toLowerCase().indexOf(search) !== -1;
    				}))


    			}
        </script>
        <paper-autocomplete
            label="Search by dataset name, topic or City department" id="find-data" remote-source="true" no-label-float="true" text-property="title" value-property="url" error-message="error">
              <template autocomplete-custom-template>
                <paper-item on-tap="_onSelect" id$="[[_getSuggestionId(index)]]" role="option" aria-selected="false">
                  <span class="autocomplete-suggestions-type">[[item.type]]:</span> <span class="autocomplete-suggestions-result">[[item.title]]</span>
                  <paper-ripple></paper-ripple>
                </paper-item>
              </template>
        </paper-autocomplete>
      </template>
    </div><!-- column -->
  </div>
</div>

<div class="container-fluid resources-promo">
  <div class="container">
    <div class="col-12">
      <h2>Get help</h2>
      <ul>
        <li>View a tutorial about this data portal</li><commit_msg>Implement no result on search.<commit_after>---
layout: front
---

<div class="container-fluid data-search">
  <div class="container">
    <div class="col-12">
      <h2>
        Find data
      </h2>
      <!--<div class="row">-->
      <template is="dom-bind">
        <script>
    			var searchIndex;
    			var findData = document.querySelector('#find-data');
    			findData.addEventListener('autocomplete-selected', onSelect);
    			findData.addEventListener('autocomplete-change', onChange);
                var noResults = {
                    "title": "Sorry, we couldn't find anything",
                    "type": "No Result",
                    "url": ""
                }

    			function onSelect(event) {
    				var selected = event.detail.text;
    				window.location.href = event.detail.value;
    			}

    			function onChange(event) {
    				var search = event.detail.option.text.toLowerCase();
    				var searchIndexURL = "{{ settings.BASE_URL }}/searchindex.json";
    				if (!searchIndex) {
    					$.getJSON(searchIndexURL, function(data){
    						searchIndex = data;
    					})
    					return;
    				}

                    suggestionsList = searchIndex.filter(function(obj){
    					return obj[findData.textProperty].toLowerCase().indexOf(search) !== -1;
    				});

                    if (suggestionsList.length == 0)
                        suggestionsList = Array(noResults);

    				findData.suggestions(suggestionsList)
    			}
        </script>
        <paper-autocomplete
            label="Search by dataset name, topic or City department" id="find-data" remote-source="true" no-label-float="true" text-property="title" value-property="url" error-message="error">
              <template autocomplete-custom-template>
                <paper-item on-tap="_onSelect" id$="[[_getSuggestionId(index)]]" role="option" aria-selected="false">
                  <span class="autocomplete-suggestions-type">[[item.type]]:</span> <span class="autocomplete-suggestions-result">[[item.title]]</span>
                  <paper-ripple></paper-ripple>
                </paper-item>
              </template>
        </paper-autocomplete>
      </template>
    </div><!-- column -->
  </div>
</div>

<div class="container-fluid resources-promo">
  <div class="container">
    <div class="col-12">
      <h2>Get help</h2>
      <ul>
        <li>View a tutorial about this data portal</li>
{'fraction_non_alphanumeric': 0.14978761457634698, 'fraction_numerical': 0.004247708473060586, 'mean_word_length': 2.2303249097472926, 'pattern_counts': {'":': 3, '<': 73, '<?xml version=': 0, '>': 73, 'https://': 0, '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': '2304273', 'n_tokens_mistral': 1450, 'n_tokens_neox': 1320, 'n_words': 238}