Skip to content

Commit

Permalink
add pygeoapi ES patch for centre-id exact match queries
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis committed Jan 30, 2025
1 parent 421598d commit 77a6e75
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
8 changes: 5 additions & 3 deletions wis2-gdc-api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@ ENV PYGEOAPI_CONFIG=/pygeoapi/local.config.yml
ENV PYGEOAPI_OPENAPI=/pygeoapi/local.openapi.yml

RUN apt-get update && \
apt-get install -y curl
apt-get install -y curl patch

COPY ./app.py /pygeoapi/pygeoapi/app.py
COPY ./docker/wis2-gdc-api.yml /pygeoapi/local.config.yml
COPY ./pygeoapi_provider_elasticsearch_.patch /pygeoapi/pygeoapi_provider_elasticsearch_.patch
COPY ./requirements.txt /app/docker/wis2-gdc-api/requirements.txt
COPY ./docker/entrypoint.sh /app/docker/wis2-gdc-api/entrypoint.sh
COPY ./docker/wis2-gdc-api.yml /pygeoapi/local.config.yml

RUN pip3 install -r /app/docker/wis2-gdc-api/requirements.txt && \
pywcmp bundle sync && \
chmod +x /app/docker/wis2-gdc-api/entrypoint.sh
chmod +x /app/docker/wis2-gdc-api/entrypoint.sh && \
patch /pygeoapi/pygeoapi/provider/elasticsearch_.py /pygeoapi/pygeoapi_provider_elasticsearch_.patch

ENTRYPOINT [ "/app/docker/wis2-gdc-api/entrypoint.sh" ]
17 changes: 17 additions & 0 deletions wis2-gdc-api/pygeoapi_provider_elasticsearch_.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
244c244,247
< prop_name = self.mask_prop(prop[0])
---
> if '|' in prop[1]:
> prop_name = self.mask_prop(prop[0])
> else:
> prop_name = f'{self.mask_prop(prop[0])}.raw'
252c255,256
< query['query']['bool']['filter'].append(pf)
---
> if '|' not in prop[1]:
> pf['match'][prop_name]['minimum_should_match'] = '100%'
254,255c258
< if '|' not in prop[1]:
< pf['match'][prop_name]['minimum_should_match'] = '100%'
---
> query['query']['bool']['filter'].append(pf)

0 comments on commit 77a6e75

Please sign in to comment.