Skip to content
This repository has been archived by the owner on Jun 22, 2023. It is now read-only.

Bug when performing filters with substring matches #187

Open
alastair opened this issue Apr 20, 2021 · 2 comments
Open

Bug when performing filters with substring matches #187

alastair opened this issue Apr 20, 2021 · 2 comments

Comments

@alastair
Copy link
Member

I added some data to the production API, ItemList id e91489d7-a776-40dd-8abf-0c934922bd99
I can query it and get all items (these queries work on prod api):

query {
  ItemList(identifier:"e91489d7-a776-40dd-8abf-0c934922bd99") {
    identifier
    name
    itemListElement {
      identifier
      name
    }
  }
}

and I can also filter and ask it to give me the item list, and all itemListElements that have a particular name:

query {
  ItemList(identifier:"e91489d7-a776-40dd-8abf-0c934922bd99") {
    identifier
    name
    itemListElement(filter:{name:"Magnificat quinti toni"}) {
      identifier
      name
    }
  }
}

But I'd also like to be able to do a more wildcard-like search, so I tried:

query {
  ItemList(identifier:"e91489d7-a776-40dd-8abf-0c934922bd99") {
    identifier
    name
    itemListElement(filter:{name_starts_with:"Missa"}) {
      identifier
      name
    }
  }
}

However this fails with an error:

Invalid input '_filter': expected
  "OR"
  "XOR"
  "AND"
  "="
  "!="
  "<>"
  "<="
  ">="
  "<"
  ">"
  "+"
  "-"
  "*"
  "/"
  "%"
  "^"
  "."
  ")"
  "["
  ":" (line 1, column 251 (offset: 250))
"MATCH (`itemList`:`ItemList` {identifier:$identifier}) RETURN `itemList` { .identifier , .name ,itemListElement: [(`itemList`)-[:`ITEM_LIST_ELEMENT`]->(`itemList_itemListElement`:`ThingInterface`) WHERE (`itemList_itemListElement`.name STARTS WITH $1_filter.name_starts_with) | `itemList_itemListElement` {FRAGMENT_TYPE: head( [ label IN labels(`itemList_itemListElement`) WHERE label IN $ThingInterface_derivedTypes ] ), .identifier , .name }] } AS `itemList`"

This makes me think that there's an issue with all of the automatically generated filters that work on strings, but I'm not sure if this is related to the graphql bindings, or something that we do with them.

@alastair
Copy link
Member Author

For now I've been able to work around it by using the regexp match:

query {
  ItemList(identifier:"e91489d7-a776-40dd-8abf-0c934922bd99") {
    identifier
    name
    itemListElement(filter:{name_regexp:"(?i).*missa.*"}) {
      identifier
      name
    }
  }
}

@ChristiaanScheermeijer
Copy link
Collaborator

I think this is an issue in the neo4j-graphql-js package. I will have to debug some more to find the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants