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

BUG - __missing__ has the same behavior with IN or SOME_NOT_IN operators #809

Open
creativeyann17 opened this issue Jan 10, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@creativeyann17
Copy link

creativeyann17 commented Jan 10, 2023

Description

Arranger 2.x build the same ES query for a __missing__ variable whatever the operator is in or some-not-in

Expected Behaviour

"content": { "field": "foo", "index": "index", "value": [ "__missing__" ] }, "op": "some-not-in"

"bool": {
    "must": [
        {
            "exists": {
                "field": "foo",
                "boost": 0
            }
        }
    ]
}

Actual Behaviour

"bool": {
    "must_not": [
        {
            "exists": {
                "field": "foo",
                "boost": 0
            }
        }
    ]
}

Possible Fix

middleware/dist/buildQuery/index.js

The isNot param should be true only if we want the field to be missing like this:

isNot: op === IN_OP,

Steps to Reproduce

query MyQuery(
  $sqon: JSON
  $first: Int
  $offset: Int
  $sort: [Sort]
) {
  Index {
    hits(filters: $sqon, first: $first, offset: $offset, sort: $sort) {
      total
      edges {
        node {
          id
         foo
       }
    }
  }
}
{
    "first": 20,
    "offset": 0,
    "sqon": {
        "content": [
            {
                "content": {
                    "field": "foo",
                    "index": "index",
                    "value": [
                        "__missing__"
                    ]
                },
                "op": "some-not-in"
            }
        ]
    },
    "sort": [ ]
}

Your Environment

  • Version used: 2.16.2
  • Environment name and version: chrome 108.0.5359.124 (Official Build) (64-bit), node: v18.1.0
  • Operating System and version: Ubuntu 22.04
  • Link to your project: Ferlab
@creativeyann17 creativeyann17 added the bug Something isn't working label Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant