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

Problem with operator <> in layer filter for Attribute Table and Widgets #9605

Closed
1 task done
ElenaGallo opened this issue Oct 16, 2023 · 1 comment · Fixed by #9628 or #9633
Closed
1 task done

Problem with operator <> in layer filter for Attribute Table and Widgets #9605

ElenaGallo opened this issue Oct 16, 2023 · 1 comment · Fixed by #9628 or #9633

Comments

@ElenaGallo
Copy link
Contributor

ElenaGallo commented Oct 16, 2023

Description

For layer filter panel of both Attribute Table and Widgets (also in dashboard), the operator <> doesn't work as expected.

How to reproduce

  • Open this map
  • Open the Attribute Table for the states layer
  • Open the Filter layer tool and configure a filter like: state_name <> alabama

or (the ame for widgets in dashboards):

  • Open this map
  • Expand the existing table widget
  • Open the widget editor and configure a filter like: state_name <> alabama

Expected Result

The record related to alabama should not appear in the table when the filter is applied

Current Result

The record related to alabama remains there

  • Not browser related
Browser info (use this site: https://www.whatsmybrowser.org/ for non expert users)
Browser Affected Version
Internet Explorer
Edge
Chrome
Firefox
Safari

Other useful information

Related to #9514 (comment)

@ElenaGallo ElenaGallo added this to the 2024.01.00 milestone Oct 16, 2023
@tdipisa tdipisa changed the title Widgets filters - Attribute Filter and Area of interest options Problem with operator <> in layer filter for Attribute Table and Widgets Oct 16, 2023
@tdipisa tdipisa added BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch and removed Widgets labels Oct 16, 2023
@tdipisa tdipisa modified the milestones: 2024.01.00, 2023.02.01 Oct 16, 2023
@MV88
Copy link
Contributor

MV88 commented Oct 18, 2023

the issue why the filter does not work is related to the * that wraps the value

<ogc:Filter>
            <ogc:And>
                <ogc:Or>
                    <ogc:PropertyIsNotEqualTo>
                        <ogc:PropertyName>STATE_NAME</ogc:PropertyName>
                        <ogc:Literal>*Alabama*</ogc:Literal>
                    </ogc:PropertyIsNotEqualTo>
                </ogc:Or>
            </ogc:And>
        </ogc:Filter>

will better investigate why it behaves like this

request that DOES NOT WORK

curl --location 'https://gs-stable.geo-solutions.it/geoserver/wfs?service=WFS&outputFormat=json' \
--header 'authority: gs-stable.geo-solutions.it' \
--header 'accept: application/json' \
--header 'accept-language: en-US,en;q=0.9' \
--header 'cache-control: no-cache' \
--header 'content-type: application/xml' \
--header 'origin: http://localhost:8081' \
--header 'pragma: no-cache' \
--header 'referer: http://localhost:8081/' \
--header 'sec-ch-ua: "Chromium";v="118", "Google Chrome";v="118", "Not=A?Brand";v="99"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "Windows"' \
--header 'sec-fetch-dest: empty' \
--header 'sec-fetch-mode: cors' \
--header 'sec-fetch-site: cross-site' \
--header 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36' \
--data '<wfs:GetFeature service="WFS" version="1.1.0" xmlns:gml="http://www.opengis.net/gml" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" startIndex="0" maxFeatures="20">
    <wfs:Query typeName="gs:us_states" srsName="EPSG:4326">
        <wfs:SortBy>
            <wfs:SortProperty>
                <ogc:PropertyName>STATE_NAME</ogc:PropertyName>
                <wfs:SortOrder>A</wfs:SortOrder>
            </wfs:SortProperty>
        </wfs:SortBy>
        <ogc:Filter>
            <ogc:And>
                <ogc:Or>
                    <ogc:PropertyIsNotEqualTo>
                        <ogc:PropertyName>STATE_NAME</ogc:PropertyName>
                        <ogc:Literal>*Alabama*</ogc:Literal>
                    </ogc:PropertyIsNotEqualTo>
                </ogc:Or>
            </ogc:And>
        </ogc:Filter>
    </wfs:Query>
</wfs:GetFeature>'

request that work

curl --location 'https://gs-stable.geo-solutions.it/geoserver/wfs?service=WFS&outputFormat=json' \
--header 'authority: gs-stable.geo-solutions.it' \
--header 'accept: application/json' \
--header 'accept-language: en-US,en;q=0.9' \
--header 'cache-control: no-cache' \
--header 'content-type: application/xml' \
--header 'origin: http://localhost:8081' \
--header 'pragma: no-cache' \
--header 'referer: http://localhost:8081/' \
--header 'sec-ch-ua: "Chromium";v="118", "Google Chrome";v="118", "Not=A?Brand";v="99"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "Windows"' \
--header 'sec-fetch-dest: empty' \
--header 'sec-fetch-mode: cors' \
--header 'sec-fetch-site: cross-site' \
--header 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36' \
--data '<wfs:GetFeature service="WFS" version="1.1.0" xmlns:gml="http://www.opengis.net/gml" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" startIndex="0" maxFeatures="20">
    <wfs:Query typeName="gs:us_states" srsName="EPSG:4326">
        <wfs:SortBy>
            <wfs:SortProperty>
                <ogc:PropertyName>STATE_NAME</ogc:PropertyName>
                <wfs:SortOrder>A</wfs:SortOrder>
            </wfs:SortProperty>
        </wfs:SortBy>
        <ogc:Filter>
            <ogc:And>
                <ogc:Or>
                    <ogc:PropertyIsNotEqualTo>
                        <ogc:PropertyName>STATE_NAME</ogc:PropertyName>
                        <ogc:Literal>Alabama</ogc:Literal>
                    </ogc:PropertyIsNotEqualTo>
                </ogc:Or>
            </ogc:And>
        </ogc:Filter>
    </wfs:Query>
</wfs:GetFeature>'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment