Skip to content

Commit d49eab1

Browse files
committed
feat: public search without text input change
1 parent 291b5f5 commit d49eab1

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

ckanext/spatial/plugin/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,15 @@ def before_dataset_index(self, pkg_dict):
198198
def before_dataset_search(self, search_params):
199199

200200
search_backend = self._get_search_backend()
201+
fq = search_params.get("fq", None)
202+
if fq:
203+
if " statewide:\"true\"" not in search_params["fq"] and " statewide:\"false\"" not in search_params["fq"]:
204+
search_params["fq"] = search_params["fq"] + " -place_keywords:\"Texas\""
205+
if " statewide:\"true\"" in search_params["fq"]:
206+
search_params["fq"] = search_params["fq"].replace(" statewide:\"true\"", "")
207+
search_params["fq"] = search_params["fq"].replace(" -place_keywords:\"Texas\"", "")
208+
if " statewide:\"false\"" in search_params["fq"]:
209+
search_params["fq"] = search_params["fq"].replace(" statewide:\"false\"", " -place_keywords:\"Texas\"")
201210

202211
input_bbox = search_params.get('extras', {}).get('ext_bbox', None)
203212

@@ -206,10 +215,8 @@ def before_dataset_search(self, search_params):
206215

207216
if not bbox:
208217
raise SearchError('Wrong bounding box provided')
209-
210218
search_params = search_backends[search_backend]().search_params(
211219
bbox, search_params)
212-
213220
return search_params
214221

215222

ckanext/spatial/public/js/spatial_query.js

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)