UNPKG

graphql-compose-elasticsearch

Version:
35 lines 1.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getWildcardITC = void 0; const utils_1 = require("../../../utils"); const FieldNames_1 = require("../../Commons/FieldNames"); function getWildcardITC(opts) { const name = (0, utils_1.getTypeName)('QueryWildcard', opts); const description = (0, utils_1.desc)(` Matches documents that have fields matching a wildcard expression (not analyzed). In order to prevent extremely SLOW wildcard queries, term should not start from * or ?. [Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html) `); const subName = (0, utils_1.getTypeName)('QueryWildcardSettings', opts); const fields = (0, FieldNames_1.getKeywordAsFieldConfigMap)(opts, opts.getOrCreateITC(subName, () => ({ name: subName, fields: { value: 'String!', boost: 'Float', }, }))); if (typeof fields === 'object') { return opts.getOrCreateITC(name, () => ({ name, description, fields, })); } return { type: 'JSON', description, }; } exports.getWildcardITC = getWildcardITC; //# sourceMappingURL=Wildcard.js.map