UNPKG

graphql-compose-elasticsearch

Version:
36 lines 1.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getFuzzyITC = void 0; const utils_1 = require("../../../utils"); const FieldNames_1 = require("../../Commons/FieldNames"); function getFuzzyITC(opts) { const name = (0, utils_1.getTypeName)('QueryFuzzy', opts); const description = (0, utils_1.desc)(` The fuzzy query uses similarity based on Levenshtein edit distance. [Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-fuzzy-query.html) `); const subName = (0, utils_1.getTypeName)('QueryFuzzySettings', opts); const fields = (0, FieldNames_1.getAnalyzedAsFieldConfigMap)(opts, opts.getOrCreateITC(subName, () => ({ name: subName, fields: { value: 'String!', boost: 'Float', fuzziness: 'Int', prefix_length: 'Int', max_expansions: 'Int', }, }))); if (typeof fields === 'object') { return opts.getOrCreateITC(name, () => ({ name, description, fields, })); } return { type: 'JSON', description, }; } exports.getFuzzyITC = getFuzzyITC; //# sourceMappingURL=Fuzzy.js.map