UNPKG

graphql-compose-elasticsearch

Version:
33 lines 1.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getPrefixITC = void 0; const utils_1 = require("../../../utils"); const FieldNames_1 = require("../../Commons/FieldNames"); function getPrefixITC(opts) { const name = (0, utils_1.getTypeName)('QueryPrefix', opts); const description = (0, utils_1.desc)(` Matches documents that have fields containing terms with a specified prefix (not analyzed). [Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-prefix-query.html) `); const subName = (0, utils_1.getTypeName)('QueryPrefixSettings', 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.getPrefixITC = getPrefixITC; //# sourceMappingURL=Prefix.js.map