graphql-compose-elasticsearch
Version:
Elastic search via GraphQL
33 lines • 1.33 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.prepareBoostingInResolve = exports.getBoostingITC = void 0;
const Query_1 = require("../Query");
const utils_1 = require("../../../utils");
function getBoostingITC(opts) {
const name = (0, utils_1.getTypeName)('QueryBoosting', opts);
const description = (0, utils_1.desc)(`
The boosting query can be used to effectively demote results that match a given query.
[Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-boosting-query.html)
`);
return opts.getOrCreateITC(name, () => ({
name,
description,
fields: {
positive: () => (0, Query_1.getQueryITC)(opts),
negative: () => (0, Query_1.getQueryITC)(opts),
negative_boost: 'Float',
},
}));
}
exports.getBoostingITC = getBoostingITC;
function prepareBoostingInResolve(boosting, fieldMap) {
if (boosting.positive) {
boosting.positive = (0, Query_1.prepareQueryInResolve)(boosting.positive, fieldMap);
}
if (boosting.negative) {
boosting.negative = (0, Query_1.prepareQueryInResolve)(boosting.negative, fieldMap);
}
return boosting;
}
exports.prepareBoostingInResolve = prepareBoostingInResolve;
//# sourceMappingURL=Boosting.js.map