UNPKG

graphql-compose-elasticsearch

Version:
35 lines 1.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getMatchPhrasePrefixITC = void 0; const utils_1 = require("../../../utils"); const FieldNames_1 = require("../../Commons/FieldNames"); function getMatchPhrasePrefixITC(opts) { const name = (0, utils_1.getTypeName)('QueryMatchPhrasePrefix', opts); const description = (0, utils_1.desc)(` The match_phrase_prefix is the same as match_phrase, except that it allows for prefix matches on the last term in the text. Eg "quick brown f" [Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase-prefix.html) `); const subName = (0, utils_1.getTypeName)('QueryMatchPhrasePrefixSettings', opts); const fields = (0, FieldNames_1.getAnalyzedAsFieldConfigMap)(opts, opts.getOrCreateITC(subName, () => ({ name: subName, fields: { query: 'String', max_expansions: 'Int', boost: 'Float', }, }))); if (typeof fields === 'object') { return opts.getOrCreateITC(name, () => ({ name, description, fields, })); } return { type: 'JSON', description, }; } exports.getMatchPhrasePrefixITC = getMatchPhrasePrefixITC; //# sourceMappingURL=MatchPhrasePrefix.js.map