Skip to content

Commit

Permalink
update records properties
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis committed Nov 6, 2023
1 parent 3130266 commit 02dd70a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docker/examples/skin/skin.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ resources:
name: TinyDBCatalogue
data: tests/data/open.canada.ca/sample-records.tinydb
id_field: externalId
time_field: recordCreated
time_field: created
title_field: title

hello-world:
Expand Down
2 changes: 1 addition & 1 deletion examples/django/sample_project/pygeoapi-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ resources:
name: TinyDBCatalogue
data: tests/data/open.canada.ca/sample-records.tinydb
id_field: externalId
time_field: recordCreated
time_field: created
title_field: title

hello-world:
Expand Down
2 changes: 1 addition & 1 deletion pygeoapi-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ resources:
name: TinyDBCatalogue
data: tests/data/open.canada.ca/sample-records.tinydb
id_field: externalId
time_field: recordCreated
time_field: created
title_field: title

hello-world:
Expand Down
10 changes: 10 additions & 0 deletions pygeoapi/provider/tinydb_.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,16 @@ def query(self, offset=0, limit=10, resulttype='results',
QUERY.append(f"(Q.properties['{prop[0]}']=='{prop[1]}')")

if q is not None:
tokens = q.split(',')
if len(tokens) == 1 and ' ' not in q:
QUERY.append(f"(Q.properties['_metadata-anytext'].search('{q}', flags=re.IGNORECASE))") # noqa
else:
Q_QUERY = []
for t in tokens:
Q_QUERY.append(f"(Q.properties['_metadata-anytext'].search('{q}', flags=re.IGNORECASE))") # noqa
QUERY.append('(' + '|'.join(Q_QUERY) + ')')


for t in q.split():
QUERY.append(f"(Q.properties['_metadata-anytext'].search('{t}', flags=re.IGNORECASE))") # noqa

Expand Down

0 comments on commit 02dd70a

Please sign in to comment.