sphinxql
Version:
SphinxQL query builder for Node.JS. Supports Sphinx search(2.x and 3.x) and Manticore search
30 lines • 1.23 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var MatchStatement_1 = require("./MatchStatement");
var WhereCondition = (function () {
function WhereCondition() {
this.matchStatement = new MatchStatement_1.default();
this.whereConditions = [];
}
WhereCondition.prototype.build = function () {
var statement = '';
var hasMatchStatement = this.matchStatement.getParts().length > 0;
var hasWhereStatements = this.whereConditions.length > 0;
if (hasWhereStatements || hasMatchStatement) {
statement = ' WHERE ';
if (hasMatchStatement) {
statement += "MATCH(" + this.matchStatement.build() + ")";
if (hasWhereStatements) {
statement += ' AND ';
}
}
var stringStatements = void 0;
stringStatements = this.whereConditions.map(function (condition) { return condition.build(); });
statement += stringStatements.join(' AND ');
}
return statement;
};
return WhereCondition;
}());
exports.default = WhereCondition;
//# sourceMappingURL=WhereCondition.js.map