<commit_before>const parseSearch = q => {
  const search = q.search

  if (!search) {
    return { match_all: {} }
  }

  return {
    simple_query_string : {
      query: `${search.trim().split(' ').join('~1 + ')}~1`, // what about "quoted searches"?
      fields: [
        'name^3',
        'alternativeNames^3',
        'activities',
        'contact.email',
        'trustees.names',
        'areasOfOperation.name',
        'causes.name',
        'beneficiaries.name',
        'operations.name'
      ],
    }
  }
}

module.exports = parseSearch<commit_msg>Add grants description to searchable fields<commit_after>const parseSearch = q => {
  const search = q.search

  if (!search) {
    return { match_all: {} }
  }

  return {
    simple_query_string : {
      query: `${search.trim().split(' ').join('~1 + ')}~1`, // what about "quoted searches"?
      fields: [
        'name^3',
        'alternativeNames^3',
        'activities',
        'contact.email',
        'trustees.names',
        'areasOfOperation.name',
        'causes.name',
        'beneficiaries.name',
        'operations.name',
        'grants.description',
      ],
    }
  }
}

module.exports = parseSearch
{'fraction_non_alphanumeric': 0.16090985678180286, 'fraction_numerical': 0.006739679865206402, 'mean_word_length': 2.176470588235294, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3810159', 'n_tokens_mistral': 389, 'n_tokens_neox': 380, 'n_words': 69}