<commit_before>{% extends "base.html" %}
{% load bootstrap3 %}
{% load ocl_tags %}
{% load humanize %}

{% block title %}Search - Open Concept Lab{% endblock title %}

{% block content-no-container %}
    <div class="container-fluid" style="margin-top:12px;">

        <!-- Start search form -->
        <form method="get" action="{% url 'search' %}" role="search">
            {% if request.GET.type %}    <input type="hidden" name="type" value="{{ request.GET.type }}"/>{% endif %}
            {% if request.GET.debug %}    <input type="hidden" name="debug" value="{{ request.GET.debug }}"/>{% endif %}
            <!-- Start content row -->
            <div class="row">

                <!-- Start Left Column -->
                <div class="col-sm-3">

                    <!-- Search Categories -->
                    <div class="hidden-xs list-group global-resource-selector">
                        <a href="{% url 'search' %}?type=concepts{{ other_resource_search_params }}&amp;sort={{ search_sort|urlencode }}"
                           class="list-group-item {% if search_type == 'concepts' %}active{% endif %}" title="Concepts"><span
                                class="glyphicon glyphicon-tag"></span><span class="">&nbsp;&nbsp;Concepts </span><span
                                class="badge">{{ resource_count.concepts|intcomma }}</span></a>
                        <a href="{% url 'search' %}?type=mappings{{ other_resource_search_params }}&amp;sort={{ search_sort|urlencode }}"
                           class="list-group-item {% if search_type == 'mappings' %}active{% endif %}" title="Mappings"><span
                                class="glyphicon glyphicon-link"></span><span class="">&nbsp;&nbsp;Mappings </span><span
                                class="badge">{{ resource_count.mappings|intcomma }}</span></a>
                        <a href="{% url 'search' %}?type=sources{{ other_resource_search_params }}&amp;sort={{ search_sort|urlencode }}"
                           class="list-group-item {% if search_type == 'sources' %}active{% endif %}"
                           title="Sources"><span class="glyphicon glyphicon-th-list"></span><span class="">&nbsp;&nbsp;Sources </span><span
                                class="badge">{{ resource_count.sources|intcomma }}</span></a>
                        <a href="{% url 'search' %}?type=collections{{ other_resource_search_params }}&amp;sort={{ search_sort|urlencode }}"
                           class="list-group-item {% if search_type == 'collections' %}active{% endif %}"
                           title="Collections"><span class="glyphicon glyphicon-tags"></span><span class="">&nbsp;&nbsp;Collections </span><span
                                class="badge">{{ resource_count.collections|intcomma }}</span></a>
                        <a href="{% url 'search' %}?type=orgs{{ other_resource_search_params }}&amp;sort={{ search_sort|urlencode }}"
                           class="list-group-item {% if search_type == 'orgs' %}active{% endif %}"
                           title="Organizations"><span class="glyphicon glyphicon-home"></span><span class="">&nbsp;&nbsp;Organizations </span><span
                                class="badge">{{ resource_count.orgs|intcomma }}</span></a>
                        <a href="{% url 'search' %}?type=users{{ other_resource_search_params }}&amp;sort={{ search_sort|urlencode }}"
                           class="list-group-item {% if search_type == 'users' %}active{% endif %}" title="Users"><span
                                class="glyphicon glyphicon-user"></span><span class="">&nbsp;&nbsp;Users </span><span
                                class="badge">{{ resource_count.users|intcomma }}</span></a>
                    </div>

                    <!-- Search Filters -->
                    <div role="form" class="hidden-xs">
                        {% for search_filter in search_filters %}
                            <div class="filter-group">
                                <div class="filter-group-header">{{ search_filter.filter_name }}</div>
                                <div class="filter-group-body">
                                    {% for filter_option in search_filter.options %}
                                        {% if filter_option.option_num > 0 or search_filter.attrs.show_zeroed_options %}
                                            <div class="checkbox"><label>{% if not search_filter.attrs.hide_numbers %}
                                                <span class="count">{{ filter_option.option_num|intcomma }}</span>{% endif %}
                                                <input type="checkbox" name="{{ search_filter.filter_id }}"
                                                       value="{{ filter_option.option_value }}"
                                                       {% if filter_option.selected %}checked{% endif %}>{{ filter_option.option_name }}
                                            </label></div>
                                        {% endif %}
                                    {% endfor %}
                                </div>
                            </div>
                        {% endfor %}
                    </div>

                    <!-- End left column -->
                </div>

                <!-- Start right column: Search results section -->
                <div class="col-sm-9" id="search-results-container">
                    <!-- Search Bar, Actions, Sorting and Paging -->
                    <div class="row" style="margin-bottom:10px;">
                        <div class="col-xs-12" style="padding-left:0">
                            {% if results and  request.user.is_authenticated %}
                            <!-- Add to collection button -->
                                {% if search_type == 'concepts' or search_type == 'mappings'%}
                                    <div class="pull-left">
                                        {% select_all_toggle checkbox_css_selector='.search-result-checkbox' data_table_rows_id='data-table-rows' %}
                                        {% add_to_collection_dropdown collections=all_collections %}
                                    </div>
                                {% endif %}
                            {% endif %}

                            {% if results %}
                                <div class="pull-right padding-left-8">
                                    <!-- Simple Pager, hidden on xs display -->
                                    {% simple_pager page search_type_name url=pagination_url pager_size="small" hide_xs=1 %}
                                </div>
                            {% endif %}

                            {% if results %}
                                <!-- Sort By Dropdown, hidden on xs display -->
                                <div class="pull-right hidden-xs btn-group padding-left-8">
                                    <button type="button" class="btn btn-default btn-sm dropdown-toggle"
                                            data-toggle="dropdown" aria-expanded="false"><span
                                            class="glyphicon glyphicon-sort"></span> <span class="caret"></span>
                                    </button>
                                    <ul class="dropdown-menu" role="menu">
                                        {% for sort_option_def in search_sort_option_defs %}
                                            <li {% if search_sort == sort_option_def.value %}class="active"{% endif %}>
                                                <a href="{% url 'search' %}?{{ other_resource_search_params }}&amp;sort={{ sort_option_def.value|urlencode }}&amp;type={{search_type_name}}s"><span
                                                        class="glyphicon {{ sort_option_def.icon }}"></span>&nbsp;{{ sort_option_def.display }}
                                                </a></li>
                                        {% endfor %}
                                    </ul>
                                </div>
                            {% endif %}
                            {% if results and search_type_name != 'organization' and search_type_name != 'user' %}
                                <div class="pull-right padding-left-8">
                                    <!-- Search results download -->
                                    {% include 'download_csv.html' with type='global_search' %}
                                </div>
                            {% endif %}

                            <!-- Exact match checkbox (always render, hidden on xs display) -->
                            <div class="hidden-xs padding-left-8 pull-right">
                                <div class="btn-group" style="padding-left:4px;margin-top:6px;">
                                    <label for="exact_match_global_search" style="font-weight:300;cursor:pointer;">
                                        <input name="exact_match" type="checkbox" tooltip="Exact match"<commit_msg>using better var for resource type<commit_after>{% extends "base.html" %}
{% load bootstrap3 %}
{% load ocl_tags %}
{% load humanize %}

{% block title %}Search - Open Concept Lab{% endblock title %}

{% block content-no-container %}
    <div class="container-fluid" style="margin-top:12px;">

        <!-- Start search form -->
        <form method="get" action="{% url 'search' %}" role="search">
            {% if request.GET.type %}    <input type="hidden" name="type" value="{{ request.GET.type }}"/>{% endif %}
            {% if request.GET.debug %}    <input type="hidden" name="debug" value="{{ request.GET.debug }}"/>{% endif %}
            <!-- Start content row -->
            <div class="row">

                <!-- Start Left Column -->
                <div class="col-sm-3">

                    <!-- Search Categories -->
                    <div class="hidden-xs list-group global-resource-selector">
                        <a href="{% url 'search' %}?type=concepts{{ other_resource_search_params }}&amp;sort={{ search_sort|urlencode }}"
                           class="list-group-item {% if search_type == 'concepts' %}active{% endif %}" title="Concepts"><span
                                class="glyphicon glyphicon-tag"></span><span class="">&nbsp;&nbsp;Concepts </span><span
                                class="badge">{{ resource_count.concepts|intcomma }}</span></a>
                        <a href="{% url 'search' %}?type=mappings{{ other_resource_search_params }}&amp;sort={{ search_sort|urlencode }}"
                           class="list-group-item {% if search_type == 'mappings' %}active{% endif %}" title="Mappings"><span
                                class="glyphicon glyphicon-link"></span><span class="">&nbsp;&nbsp;Mappings </span><span
                                class="badge">{{ resource_count.mappings|intcomma }}</span></a>
                        <a href="{% url 'search' %}?type=sources{{ other_resource_search_params }}&amp;sort={{ search_sort|urlencode }}"
                           class="list-group-item {% if search_type == 'sources' %}active{% endif %}"
                           title="Sources"><span class="glyphicon glyphicon-th-list"></span><span class="">&nbsp;&nbsp;Sources </span><span
                                class="badge">{{ resource_count.sources|intcomma }}</span></a>
                        <a href="{% url 'search' %}?type=collections{{ other_resource_search_params }}&amp;sort={{ search_sort|urlencode }}"
                           class="list-group-item {% if search_type == 'collections' %}active{% endif %}"
                           title="Collections"><span class="glyphicon glyphicon-tags"></span><span class="">&nbsp;&nbsp;Collections </span><span
                                class="badge">{{ resource_count.collections|intcomma }}</span></a>
                        <a href="{% url 'search' %}?type=orgs{{ other_resource_search_params }}&amp;sort={{ search_sort|urlencode }}"
                           class="list-group-item {% if search_type == 'orgs' %}active{% endif %}"
                           title="Organizations"><span class="glyphicon glyphicon-home"></span><span class="">&nbsp;&nbsp;Organizations </span><span
                                class="badge">{{ resource_count.orgs|intcomma }}</span></a>
                        <a href="{% url 'search' %}?type=users{{ other_resource_search_params }}&amp;sort={{ search_sort|urlencode }}"
                           class="list-group-item {% if search_type == 'users' %}active{% endif %}" title="Users"><span
                                class="glyphicon glyphicon-user"></span><span class="">&nbsp;&nbsp;Users </span><span
                                class="badge">{{ resource_count.users|intcomma }}</span></a>
                    </div>

                    <!-- Search Filters -->
                    <div role="form" class="hidden-xs">
                        {% for search_filter in search_filters %}
                            <div class="filter-group">
                                <div class="filter-group-header">{{ search_filter.filter_name }}</div>
                                <div class="filter-group-body">
                                    {% for filter_option in search_filter.options %}
                                        {% if filter_option.option_num > 0 or search_filter.attrs.show_zeroed_options %}
                                            <div class="checkbox"><label>{% if not search_filter.attrs.hide_numbers %}
                                                <span class="count">{{ filter_option.option_num|intcomma }}</span>{% endif %}
                                                <input type="checkbox" name="{{ search_filter.filter_id }}"
                                                       value="{{ filter_option.option_value }}"
                                                       {% if filter_option.selected %}checked{% endif %}>{{ filter_option.option_name }}
                                            </label></div>
                                        {% endif %}
                                    {% endfor %}
                                </div>
                            </div>
                        {% endfor %}
                    </div>

                    <!-- End left column -->
                </div>

                <!-- Start right column: Search results section -->
                <div class="col-sm-9" id="search-results-container">
                    <!-- Search Bar, Actions, Sorting and Paging -->
                    <div class="row" style="margin-bottom:10px;">
                        <div class="col-xs-12" style="padding-left:0">
                            {% if results and  request.user.is_authenticated %}
                            <!-- Add to collection button -->
                                {% if search_type == 'concepts' or search_type == 'mappings'%}
                                    <div class="pull-left">
                                        {% select_all_toggle checkbox_css_selector='.search-result-checkbox' data_table_rows_id='data-table-rows' %}
                                        {% add_to_collection_dropdown collections=all_collections %}
                                    </div>
                                {% endif %}
                            {% endif %}

                            {% if results %}
                                <div class="pull-right padding-left-8">
                                    <!-- Simple Pager, hidden on xs display -->
                                    {% simple_pager page search_type_name url=pagination_url pager_size="small" hide_xs=1 %}
                                </div>
                            {% endif %}

                            {% if results %}
                                <!-- Sort By Dropdown, hidden on xs display -->
                                <div class="pull-right hidden-xs btn-group padding-left-8">
                                    <button type="button" class="btn btn-default btn-sm dropdown-toggle"
                                            data-toggle="dropdown" aria-expanded="false"><span
                                            class="glyphicon glyphicon-sort"></span> <span class="caret"></span>
                                    </button>
                                    <ul class="dropdown-menu" role="menu">
                                        {% for sort_option_def in search_sort_option_defs %}
                                            <li {% if search_sort == sort_option_def.value %}class="active"{% endif %}>
                                                <a href="{% url 'search' %}?{{ other_resource_search_params }}&amp;sort={{ sort_option_def.value|urlencode }}&amp;type={{search_type}}"><span
                                                        class="glyphicon {{ sort_option_def.icon }}"></span>&nbsp;{{ sort_option_def.display }}
                                                </a></li>
                                        {% endfor %}
                                    </ul>
                                </div>
                            {% endif %}
                            {% if results and search_type_name != 'organization' and search_type_name != 'user' %}
                                <div class="pull-right padding-left-8">
                                    <!-- Search results download -->
                                    {% include 'download_csv.html' with type='global_search' %}
                                </div>
                            {% endif %}

                            <!-- Exact match checkbox (always render, hidden on xs display) -->
                            <div class="hidden-xs padding-left-8 pull-right">
                                <div class="btn-group" style="padding-left:4px;margin-top:6px;">
                                    <label for="exact_match_global_search" style="font-weight:300;cursor:pointer;">
                                        <input name="exact_match" type="checkbox" tooltip="Exact match"
{'fraction_non_alphanumeric': 0.13699380787988383, 'fraction_numerical': 0.0023014959723820483, 'mean_word_length': 1.3042929292929293, 'pattern_counts': {'":': 0, '<': 231, '<?xml version=': 0, '>': 231, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 116, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3211796', 'n_tokens_mistral': 4491, 'n_tokens_neox': 4040, 'n_words': 842}