searchFields = function (searchTerm, fields, excludeTokens, excludeFilename, excludeInfo) {
  if (!searchTerm) { searchTerm = ''; }
  return fields.filter((field) => {
    if (field.regex !== undefined || field.noFacet === 'true') {
      return false;
    }

    if (excludeTokens && field.type && field.type.includes('textfield')) {
      return false;
    }

    if (excludeFilename && field.type && field.type === 'fileand') {
      return false;
    }

    if (excludeInfo && field.exp === 'info') {
      return false;
    }

    searchTerm = searchTerm.toLowerCase();
    return field.friendlyName.toLowerCase().includes(searchTerm) ||
      field.exp.toLowerCase().includes(searchTerm) ||
      (field.aliases && field.aliases.some(item => {
        return item.toLowerCase().includes(searchTerm);
      }));
  });
}
Searches fields for a term
Looks for the term in field friendlyName, exp, and aliases

@example
'{{ searchTerm | searchFields(fields, true) }}'
this.$options.filters.searchFields('test', this.fields, true);

@param {string} searchTerm       The string to search for within the fields
@param {array} fields            The list of fields to search
@param {boolean} excludeTokens   Whether to exclude token fields
@param {boolean} excludeFilename Whether to exclude the filename field
@param {boolean} excludeInfo     Whether to exclude the special info "field"
@returns {array}                 An array of fields that match the search term