Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to fix CSW GetRecords issue from mapstore #253

Merged
merged 4 commits into from
Oct 9, 2023

Conversation

pmauduit
Copy link
Member

@pmauduit pmauduit commented Oct 5, 2023

On current georchestra's geonetwork version (based of GN4.2), the following payload on the CSW endpoint (generated from the mapstore UI when trying to add a layer from the local catalogue) is translated to an invalid query sent to Elasticsearch:

<?xml version="1.0"?>
<csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dct="http://purl.org/dc/terms/" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:ows="http://www.opengis.net/ows" service="CSW" version="2.0.2" resultType="results" startPosition="1" maxRecords="4">
  <csw:Query typeNames="csw:Record">
    <csw:ElementSetName>full</csw:ElementSetName>
    <csw:Constraint version="1.1.0">
      <ogc:Filter>
        <ogc:Or>
          <ogc:PropertyIsEqualTo>
            <ogc:PropertyName>dc:type</ogc:PropertyName>
            <ogc:Literal>dataset</ogc:Literal>
          </ogc:PropertyIsEqualTo>
          <ogc:PropertyIsEqualTo>
            <ogc:PropertyName>dc:type</ogc:PropertyName>
            <ogc:Literal>http://purl.org/dc/dcmitype/Dataset</ogc:Literal>
          </ogc:PropertyIsEqualTo>
        </ogc:Or>
      </ogc:Filter>
    </csw:Constraint>
  </csw:Query>
</csw:GetRecords>

It turns out it works if the purl.org url is double-quoted. @cmangeat already provided a fix into an "unofficial" branch from this repository. This PR is just about cherry-picking the work and attempt to fix the IT testsuite.

@pmauduit
Copy link
Member Author

pmauduit commented Oct 5, 2023

I had a talk with @cmangeat who told me that his "heroïc fix" is heroïc in the sense we should definitely not do it this way.

@pmauduit
Copy link
Member Author

pmauduit commented Oct 5, 2023

But at least, my spec is passing with the following PR:
image

@pmauduit pmauduit marked this pull request as draft October 5, 2023 17:16
@pmauduit pmauduit marked this pull request as ready for review October 9, 2023 09:06
@fvanderbiest
Copy link
Member

fvanderbiest commented Oct 9, 2023

I had a talk with @cmangeat who told me that his "heroïc fix" is heroïc in the sense we should definitely not do it this way.

I see it has been fixed upstream on 4.2.6, which we are upgrading to on geOrchestra master.
Hence this looks like an acceptable local fix for 23.0.

The current PR on the branch targeted by geOrchestra master can be discarded IMO.

@pmauduit pmauduit merged commit 18c1c89 into georchestra-gn4.2.x Oct 9, 2023
1 check passed
@pmauduit pmauduit deleted the csw-getrecords-fix branch October 9, 2023 12:40
@fvanderbiest fvanderbiest added this to the 23.0.3 milestone Oct 31, 2023
f-necas added a commit that referenced this pull request Jan 9, 2024
f-necas added a commit that referenced this pull request Jan 10, 2024
* Revert #253

* CSW GetRecords doesn't escape query values when creating the Elasticsearch query. Fixes #7527

* CSW GetRecords doesn't escape query values when creating the Elasticsearch query / Escape Elasticsearch special chars in EQUAL / NOT EQUAL literal queries

* CSW GetRecords doesn't escape query values when creating the Elasticsearch query / Escape Elasticsearch special chars in IS LIKE literal queries

* Reset geotools usage and comments tests

---------

Co-authored-by: Jose García <[email protected]>
f-necas added a commit that referenced this pull request Jan 10, 2024
* Revert #253

* CSW GetRecords doesn't escape query values when creating the Elasticsearch query. Fixes #7527

* CSW GetRecords doesn't escape query values when creating the Elasticsearch query / Escape Elasticsearch special chars in EQUAL / NOT EQUAL literal queries

* CSW GetRecords doesn't escape query values when creating the Elasticsearch query / Escape Elasticsearch special chars in IS LIKE literal queries

* Reset geotools usage and comments tests

---------

Co-authored-by: Jose García <[email protected]>
f-necas added a commit that referenced this pull request Jan 25, 2024
* Revert #253

* CSW GetRecords doesn't escape query values when creating the Elasticsearch query. Fixes #7527

* CSW GetRecords doesn't escape query values when creating the Elasticsearch query / Escape Elasticsearch special chars in EQUAL / NOT EQUAL literal queries

* CSW GetRecords doesn't escape query values when creating the Elasticsearch query / Escape Elasticsearch special chars in IS LIKE literal queries

* Reset geotools usage and comments tests

---------

Co-authored-by: Jose García <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants