graphql-compose-elasticsearch
Version:
Elastic search via GraphQL
39 lines • 1.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCommonITC = void 0;
const utils_1 = require("../../../utils");
const FieldNames_1 = require("../../Commons/FieldNames");
function getCommonITC(opts) {
const name = (0, utils_1.getTypeName)('QueryCommon', opts);
const description = (0, utils_1.desc)(`
The common terms query is a modern alternative to stopwords which improves
the precision and recall of search results (by taking stopwords into account),
without sacrificing performance.
[Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-common-terms-query.html)
`);
const subName = (0, utils_1.getTypeName)('QueryCommonSettings', opts);
const fields = (0, FieldNames_1.getAnalyzedAsFieldConfigMap)(opts, opts.getOrCreateITC(subName, () => ({
name: subName,
fields: {
query: 'String',
cutoff_frequency: 'Float',
minimum_should_match: 'JSON',
low_freq_operator: 'String',
high_freq_operator: 'String',
boost: 'Float',
},
})));
if (typeof fields === 'object') {
return opts.getOrCreateITC(name, () => ({
name,
description,
fields,
}));
}
return {
type: 'JSON',
description,
};
}
exports.getCommonITC = getCommonITC;
//# sourceMappingURL=Common.js.map