Skip to content

Commit 84ea68b

Browse files
committed
Make binding of AND after OR explicit
We first want to do a disjunctive query on all names and then add any potential additional filters as a joint conjunction at the end of that.
1 parent 332ab20 commit 84ea68b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

services/features.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ function getByPoint(query, callback) {
150150
function getByName(query, callback) {
151151
const names = query.name.constructor === Array ? query.name : [query.name];
152152

153-
let namesDisjunction = names.map(function(name) {
153+
let namesDisjunction = `(${names.map(function(name) {
154154
return `lower(name) = ${escapeSql(name.toLowerCase())}`;
155-
}).join(" OR ");
155+
}).join(" OR ")})`;
156156
let nameQuery = `SELECT ${buildQueryColumns(query)} FROM features WHERE ${namesDisjunction}`;
157157

158158
if (query.layer) {

0 commit comments

Comments
 (0)