neo4j / graphql

A GraphQL to Cypher query execution layer for Neo4j and JavaScript GraphQL implementations.
https://neo4j.com/docs/graphql-manual/current/
Apache License 2.0
504 stars 149 forks source link

ogm model functions' `fulltext` arg not working #2357

Closed pathologyenigma closed 1 year ago

pathologyenigma commented 1 year ago

Describe the bug model.find and model.aggregate functions' fulltext arg not working whatever the input is

Type definitions

// model definition
type Enterprise @node @fulltext(indexes: [{name: "search_by_name_tags_profile_or_extra_attributes", fields:["full_name", "tags"]}]){
        id: ID! @id
        full_name: String!
        tags: String
    }

To Reproduce

// query

let list = await Enterprise.find({
        where,
        // not working without this
        //args: {
        //     fulltext: search_keyword ? {
        //         search_by_name_tags_profile_or_extra_attributes: { phrase: search_keyword }
        //     } : undefined
        // },
        fulltext: {
            search_by_name_tags_profile_or_extra_attributes: { phrase: search_keyword }
        },
        options: {
        offset: page ? page * pageSize : 0,
        limit: pageSize
    }
})
// aggregate
let count = (await Enterprise.aggregate({
    aggregate: {
        count: true
    },
    fulltext:  {
        search_by_name_tags_profile_or_extra_attributes: { phrase: search_keyword }
    },
    where,
})).count
// get this data(the only data in the database) whatever the search_keyword is
{
  "data": {
    "get_enterprise_list": {
      "count": 1,
      "list": [
        {
          "id": "30f18955-0b7d-48a1-a3e8-17b050397de8",
          "full_name": "aaaa",
          "tags": null
        }
      ]
    }
  }
}

Expected behavior search result is empty when I input "123456"

Screenshots

System (please complete the following information):

Additional context the problem will fix for find function if I put the whole fulltext object inside args I checked the code maybe fulltext arg is ignored here and here

neo4j-team-graphql commented 1 year ago

Many thanks for raising this bug report @pathologyenigma. :bug: We will now attempt to reproduce the bug based on the steps you have provided.

Please ensure that you've provided the necessary information for a minimal reproduction, including but not limited to:

If you have a support agreement with Neo4j, please link this GitHub issue to a new or existing Zendesk ticket.

Thanks again! :pray:

neo4j-team-graphql commented 1 year ago

We've been able to confirm this bug using the steps to reproduce that you provided - many thanks @pathologyenigma! :pray: We will now prioritise the bug and address it appropriately.