<commit_before>(function(env) {
    "use strict";
    
    env.ddg_spice_indeed_jobs = function(api_result) {
        if (api_result.error || !api_result.results.length) {
            return Spice.failed('indeed_jobs');
        }

        var q = api_result.query || '',
            loc = api_result.location || '',
            re = /^http:\/\/([a-z.]+)\//,
            rematch = api_result.results[0].url.match(re),
            www_domain = rematch ? rematch[0] : "http://www.indeed.com/";
        
        Spice.add({
            id: "indeed_jobs",
            name: "Jobs",
            data: api_result.results,
            meta: {
                sourceName: "Indeed",
                sourceUrl: www_domain + 'jobs?q=' + encodeURIComponent(q) + '&l=' + encodeURIComponent(loc)
            },
            normalize: function(item) {
                return {
                    url: item.url,
                    title: item.jobtitle,
                    subtitle: item.company,
                    description: DDG.strip_html(item.snippet)
                };
            },
            templates: {
                group: 'text',
                detail: false,
                item_detail: false,
                options: {
                    footer: Spice.indeed_jobs.footer
                },
                variants: {
                    tileTitle: '2line',
                    tileSnippet: 'large',
                    tileFooter: '2line'
                }
            }
        });<commit_msg>IndeedJobs: Add relevancy check<commit_after>(function(env) {
    "use strict";

    env.ddg_spice_indeed_jobs = function(api_result) {
        if (api_result.error || !api_result.results.length) {
            return Spice.failed('indeed_jobs');
        }

        var q = api_result.query || '',
            loc = api_result.location || '',
            re = /^http:\/\/([a-z.]+)\//,
            rematch = api_result.results[0].url.match(re),
            www_domain = rematch ? rematch[0] : "http://www.indeed.com/";

        Spice.add({
            id: "indeed_jobs",
            name: "Jobs",
            data: api_result.results,
            meta: {
                sourceName: "Indeed",
                sourceUrl: www_domain + 'jobs?q=' + encodeURIComponent(q) + '&l=' + encodeURIComponent(loc)
            },
            normalize: function(item) {
                // ensure job is relevant to query
                if (q.length && !DDG.stringsRelevant(item.jobtitle, q)){
                    return null;
                }

                return {
                    url: item.url,
                    title: item.jobtitle,
                    subtitle: item.company,
                    description: DDG.strip_html(item.snippet)
                };
            },
            templates: {
                group: 'text',
                detail: false,
                item_detail: false,
                options: {
                    footer: Spice.indeed_jobs.footer
                },
                variants: {
                    tileTitle: '2line',
                    tileSnippet: 'large',
                    tileFooter: '2line'
                }
            }
        });
{'fraction_non_alphanumeric': 0.1206140350877193, 'fraction_numerical': 0.002506265664160401, 'mean_word_length': 1.153068105192178, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, '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': '7135296', 'n_tokens_mistral': 917, 'n_tokens_neox': 860, 'n_words': 149}