DomDew / strapi-plugin-fuzzy-search

Register a weighted fuzzy search endpoint for Strapi Headless CMS you can add your content types to in no time

Home Page:https://www.npmjs.com/package/strapi-plugin-fuzzy-search

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Graphql results showing null

skpopcornapps opened this issue · comments

The rest api
for eg: http://localhost:1337/api/fuzzy-search/search?query=/home is giving me the results
but for graphql

query{
    search (query: "/home"){
        basicPages{
            data{
                attributes{
                    PageRoute
                }
            }
        }
        cabinDetailsPages{
            data{
                attributes{
                    PageRoute
                }
            }
        }
    }
}

Im getting null as output.

{
    "data": {
        "search": {
            "basicPages": null,
            "cabinDetailsPages": null
        }
    }
}

Hey @skpopcornapps,
thanks for opening this issue. Did you do any manual configuration to Strapis Graphql Plugin?
Also, would you mind sharing which Strapi version you are on? Maybe I can find whats going on. Query seems correct to me.

Thank you for the reply @DomDew

graphql: {
    config: {
      endpoint: "/graphql",
      shadowCRUD: true,
      playgroundAlways: true,
      apolloServer: {
        tracing: false,
      },
    },
  },

This is the config I have for graphql in plugins.ts

Strapi version is 4.4.5 with typescript

Hey @skpopcornapps,

sadly I can't reproduce your issue... I set up a Strapi instance on v4.4.5 with a minimal example to reproduce your issue.

config for the content type is:

{
 uid: "api::page.page",
modelName: "page",
fuzzysortOptions: {
  characterLimit: 300,
  threshold: -3000,
  limit: 10,
  keys: [
    {
       name: "route",
     },
   ],
  },
},

query:

query {
  search(query: "/home") {
    pages {
      data {
        attributes {
          route
        }
      }
    }
  }
}

Response:

{
  "data": {
    "search": {
      "pages": {
        "data": [
          {
            "attributes": {
              "route": "/home"
            }
          }
        ]
      }
    }
  }
}

Do you have any other Plugin installed that may interact with graphql in any way?

@skpopcornapps Fixed in 1.10.3!