<commit_before>import Ember from 'ember';
import moment from 'moment';

/*
 * @function dateRangeFilter
 * @param String field Name of the date field to filter
 * @param Object start Beginning of date range
 * @param Object end End of date range
 */
function dateRangeFilter(field, start, end) {
    if (start && end) {
        let filter = { range: {} };
        filter.range[field] = {
            gte: moment(start).format(),
            lte: moment(end).format()
        };
        return filter;
    } else {
        return null;
    }
}

/*
 * @function termsFilter
 * @param String field Name of the field to filter
 * @param Array terms List of terms to match
 * @param Boolean [all] If true (default), return an array of filters to match results with *all* of the terms. Otherwise, return a single filter to match results with *any* of the terms.
 */
function termsFilter(field, terms, all = true) {
    if (terms && terms.length) {
        if (['contributors', 'funders', 'identifiers', 'tags', 'publishers'].includes(field)) {
            field = field + '.exact';<commit_msg>Inclusive date range search. (#181)<commit_after>import Ember from 'ember';
import moment from 'moment';

/*
 * @function dateRangeFilter
 * @param String field Name of the date field to filter
 * @param Object start Beginning of date range
 * @param Object end End of date range
 */
function dateRangeFilter(field, start, end) {
    if (start && end) {
        let filter = { range: {} };
        filter.range[field] = {
            gte: `${moment(start).format('YYYY-MM-DD')}||/d`,
            lte: `${moment(end).format('YYYY-MM-DD')}||/d`
        };
        return filter;
    } else {
        return null;
    }
}

/*
 * @function termsFilter
 * @param String field Name of the field to filter
 * @param Array terms List of terms to match
 * @param Boolean [all] If true (default), return an array of filters to match results with *all* of the terms. Otherwise, return a single filter to match results with *any* of the terms.
 */
function termsFilter(field, terms, all = true) {
    if (terms && terms.length) {
        if (['contributors', 'funders', 'identifiers', 'tags', 'publishers'].includes(field)) {
            field = field + '.exact';
{'fraction_non_alphanumeric': 0.12689901697944594, 'fraction_numerical': 0.0013404825737265416, 'mean_word_length': 2.941901408450704, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1175619', 'n_tokens_mistral': 638, 'n_tokens_neox': 627, 'n_words': 247}