<commit_before>{% extends "base.html" %}
{% set active_page = "results" %}

{% block content %}
<section class="results">
    <div class="container">
        <div class="row jumbotron-search">
            <div class="col-xs-12 col-md-12 text-center">
                <h1>Buscador de productos</h1>
                <div class="row">
                    <div class="col-xs-4 col-xs-offset-3">
                        <input type="text" class="input-group-lg form-control" placeholder="¿Qué buscas?">
                    </div>
                    <div class="col-xs-2">
                        <a id="search" src="#" class="btn btn-primary btn-search">Buscar</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
<section class="found">
    <div class="container">
        <div class="row">
            <div class="col-xs-6">
                <p class="n-products-found"><span id="n_results">0</span> productos para "<span id="search_term"></span>"</p>
            </div>
            <div class="col-xs-6">
                <!-- Single button -->
                <div class="btn-group pull-right">
                    <button id="default-option" type="button" class="btn btn-options dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        Todos los productos <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a id="dropdown-gluten-free" href="#">Sin gluten</a></li>
                        <li><a id="dropdown-wheat" href="#">Trigo o trazas</a></li>
                        <li><a id="dropdown-all" href="#">Todos los productos</a></li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="row products"></div>
    </div>
</div>
</section>
<section class="selected-product">
<div class="container">
    <div class="row">
        <div class="col-xs-12">
            <a href="#" id="back"><i class="fa fa-chevron-left"></i> Atrás</a>
        </div>
    </div>
</div>
</section>
{% endblock %}

{% block extrajs %}
<script>
console.log($("#search").attr("id"));
$("input").keyup(function(event){
        if(event.keyCode == 13){
        $("#search").click();
        }
        });


$("#dropdown-wheat").off('click').on('click', function(){
        var html = $("#dropdown-wheat").text() + ' <span class="caret"></span>';
        $("#default-option").html(html);
        $(".col-xs-3").hide();
        $(".col-xs-3.wheat").show();
        $("#n_results").text($(".col-xs-3.wheat").length);
        }); 

$("#dropdown-gluten-free").off('click').on('click', function(){
        var html = $("#dropdown-gluten-free").text() + ' <span class="caret"></span>';
        $("#default-option").html(html);
        $(".col-xs-3").hide();
        $(".col-xs-3.gluten-free").show();
        $("#n_results").text($(".col-xs-3.gluten-free").length);
        }); 

$("#dropdown-all").off('click').on('click', function(){
        var html = $("#dropdown-all").text() + ' <span class="caret"></span>';
        $("#default-option").html(html);
        $(".col-xs-3").show();
        $("#n_results").text($(".col-xs-3").length);
        }); 

$("#back").off('click').on('click', function(){
        $(".row.products").show();
        $(".found").show();
        $(".selected-product").hide();
        var id = $("#back").data("close");
        $("#" + id + "-big").hide();
        });


$("#search").off('click').on('click', function(){
        var data = $("input").val();
        data = data.replace(/ +/g, ' ');
        data = data.replace(/^ /gi, "");
        data = data.replace(/ $/gi, "");
        console.log(data);
        if ((data.match(/ /g) || []).length >= 1) {
        var query = data.replace(/ /g, '%26');
        }
        else {
        var query = data.replace(/ /g, '');
        }
        $.ajax({
url: "/api/result?project_id=3292&info=name::" + query + "&fulltextsearch=1",
})
        .done(function( data ) {
            if ( console && console.log ) {
            console.log( "Sample of data:", data.slice( 0, 100 ) );
            $(".row.products").html("");
            $(".found").show();
            $("#n_results").text(data.length);
            $("#search_term").text($("input").val());

            if (data.length > 0) {
            for (i=0; i<data.length;i++) {
            var col = $("<div/>");
            col.addClass("col-xs-3");
            var product = $("<div/>");
            product.attr("id", "product-" + i);
            product.addClass("product");
            var brand = $("</p>");
            brand.addClass("brand");
            var name = $("</p>");
            name.addClass("name");
            var labels = $("</p>");
            if (data[i]['info']['labelGlutenFree'] === 'yes') {
                var iconGlutenFree = $("<img>");
                iconGlutenFree.attr("src", "http://placehold.it/16x16");
                labels.text(" Sin gluten");
                labels.prepend(iconGlutenFree);
                labels.addClass("gluten-free");
                col.addClass("gluten-free");<commit_msg>Add project_id manually.<commit_after>{% extends "base.html" %}
{% set active_page = "results" %}

{% block content %}
<section class="results">
    <div class="container">
        <div class="row jumbotron-search">
            <div class="col-xs-12 col-md-12 text-center">
                <h1>Buscador de productos</h1>
                <div class="row">
                    <div class="col-xs-4 col-xs-offset-3">
                        <input type="text" class="input-group-lg form-control" placeholder="¿Qué buscas?">
                    </div>
                    <div class="col-xs-2">
                        <a id="search" src="#" class="btn btn-primary btn-search">Buscar</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
<section class="found">
    <div class="container">
        <div class="row">
            <div class="col-xs-6">
                <p class="n-products-found"><span id="n_results">0</span> productos para "<span id="search_term"></span>"</p>
            </div>
            <div class="col-xs-6">
                <!-- Single button -->
                <div class="btn-group pull-right">
                    <button id="default-option" type="button" class="btn btn-options dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        Todos los productos <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a id="dropdown-gluten-free" href="#">Sin gluten</a></li>
                        <li><a id="dropdown-wheat" href="#">Trigo o trazas</a></li>
                        <li><a id="dropdown-all" href="#">Todos los productos</a></li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="row products"></div>
    </div>
</div>
</section>
<section class="selected-product">
<div class="container">
    <div class="row">
        <div class="col-xs-12">
            <a href="#" id="back"><i class="fa fa-chevron-left"></i> Atrás</a>
        </div>
    </div>
</div>
</section>
{% endblock %}

{% block extrajs %}
<script>
console.log($("#search").attr("id"));
$("input").keyup(function(event){
        if(event.keyCode == 13){
        $("#search").click();
        }
        });


$("#dropdown-wheat").off('click').on('click', function(){
        var html = $("#dropdown-wheat").text() + ' <span class="caret"></span>';
        $("#default-option").html(html);
        $(".col-xs-3").hide();
        $(".col-xs-3.wheat").show();
        $("#n_results").text($(".col-xs-3.wheat").length);
        }); 

$("#dropdown-gluten-free").off('click').on('click', function(){
        var html = $("#dropdown-gluten-free").text() + ' <span class="caret"></span>';
        $("#default-option").html(html);
        $(".col-xs-3").hide();
        $(".col-xs-3.gluten-free").show();
        $("#n_results").text($(".col-xs-3.gluten-free").length);
        }); 

$("#dropdown-all").off('click').on('click', function(){
        var html = $("#dropdown-all").text() + ' <span class="caret"></span>';
        $("#default-option").html(html);
        $(".col-xs-3").show();
        $("#n_results").text($(".col-xs-3").length);
        }); 

$("#back").off('click').on('click', function(){
        $(".row.products").show();
        $(".found").show();
        $(".selected-product").hide();
        var id = $("#back").data("close");
        $("#" + id + "-big").hide();
        });


$("#search").off('click').on('click', function(){
        var data = $("input").val();
        data = data.replace(/ +/g, ' ');
        data = data.replace(/^ /gi, "");
        data = data.replace(/ $/gi, "");
        console.log(data);
        if ((data.match(/ /g) || []).length >= 1) {
        var query = data.replace(/ /g, '%26');
        }
        else {
        var query = data.replace(/ /g, '');
        }
        $.ajax({
url: "/api/result?project_id=10&info=name::" + query + "&fulltextsearch=1",
})
        .done(function( data ) {
            if ( console && console.log ) {
            console.log( "Sample of data:", data.slice( 0, 100 ) );
            $(".row.products").html("");
            $(".found").show();
            $("#n_results").text(data.length);
            $("#search_term").text($("input").val());

            if (data.length > 0) {
            for (i=0; i<data.length;i++) {
            var col = $("<div/>");
            col.addClass("col-xs-3");
            var product = $("<div/>");
            product.attr("id", "product-" + i);
            product.addClass("product");
            var brand = $("</p>");
            brand.addClass("brand");
            var name = $("</p>");
            name.addClass("name");
            var labels = $("</p>");
            if (data[i]['info']['labelGlutenFree'] === 'yes') {
                var iconGlutenFree = $("<img>");
                iconGlutenFree.attr("src", "http://placehold.it/16x16");
                labels.text(" Sin gluten");
                labels.prepend(iconGlutenFree);
                labels.addClass("gluten-free");
                col.addClass("gluten-free");
{'fraction_non_alphanumeric': 0.23032351521004346, 'fraction_numerical': 0.008112023177209078, 'mean_word_length': 1.8513215859030836, 'pattern_counts': {'":': 0, '<': 173, '<?xml version=': 0, '>': 175, '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': '1050303', 'n_tokens_mistral': 3207, 'n_tokens_neox': 3113, 'n_words': 549}