diff --git a/pygeoapi/provider/tinydb_.py b/pygeoapi/provider/tinydb_.py index 099bb28..1ca6026 100644 --- a/pygeoapi/provider/tinydb_.py +++ b/pygeoapi/provider/tinydb_.py @@ -29,6 +29,7 @@ import logging import os +import re # noqa from tinydb import TinyDB, Query @@ -156,7 +157,7 @@ class TinyDBCatalogueProvider(BaseProvider): if q is not None: for t in q.split(): - QUERY.append("(Q.properties['_metadata-anytext'].search('{}'))".format(t)) # noqa + QUERY.append("(Q.properties['_metadata-anytext'].search('{}', flags=re.IGNORECASE))".format(t)) # noqa QUERY_STRING = '&'.join(QUERY) LOGGER.debug('QUERY_STRING: {}'.format(QUERY_STRING)) diff --git a/tests/test_tinydb_catalogue_provider.py b/tests/test_tinydb_catalogue_provider.py index 3bb28d4..03d0225 100644 --- a/tests/test_tinydb_catalogue_provider.py +++ b/tests/test_tinydb_catalogue_provider.py @@ -64,10 +64,11 @@ def test_query(config): assert results['features'][0]['id'] == 'e5a71860-827c-453f-990e-0e0ba0ee67bb' # noqa assert results['features'][0]['properties']['type'] == 'RI_622' - results = p.query(q='crops') - assert len(results['features']) == 6 - assert results['numberMatched'] == 6 - assert results['numberReturned'] == 6 + for term in ['crops', 'Crops', 'CROPS', 'CrOpS', 'CROps', 'CRops']: + results = p.query(q=term) + assert len(results['features']) == 6 + assert results['numberMatched'] == 6 + assert results['numberReturned'] == 6 results = p.query(q='crops barley') assert len(results['features']) == 2