Skip to content

Commit aa34974

Browse files
committed
Add option to filter any query by name
This is generally useful, e.g. imagine querying for all features in a bounding box or at a particular point but while already having an idea of the names of features that we want to retrieve. Additionally, the feature will be used in the Fortis dashboard for implementing auto-suggest in the place search pane.
1 parent 24a9329 commit aa34974

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

controllers/features.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ exports.getByBoundingBox = function(req, res) {
7474
west: parseFloat(req.params.west),
7575
south: parseFloat(req.params.south),
7676
east: parseFloat(req.params.east),
77+
filter_name: req.query.filter_name,
7778
include: req.query.include
7879
};
7980

services/features.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ function addQueryPredicates(sql, query) {
127127
sql += ` AND layer = ${escapeSql(query.layer)}`;
128128
}
129129

130+
if (query.filter_name) {
131+
sql += ` AND strpos(lower(name), ${escapeSql(query.filter_name.toLowerCase())}) > 0`;
132+
}
133+
130134
return sql;
131135
}
132136

0 commit comments

Comments
 (0)