0

The Query:

{
  search(fieldsEqual:[
    {name:"_fullpath", value:"/sitecore/content/*" }
   ]) {
    results {
      totalCount
      }
  }
}

The Result:

  "data": {
    "search": null
  },
  "errors": [
    {
      "message": "Error trying to resolve search.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "search"
      ],
      "extensions": {
        "code": "INVALID_OPERATION"
      }
    }
  ]
}

Config Settings:

<queries hint="raw:AddQuery">
                  <!-- enable querying on items via this API -->
                  <query name="item" type="Sitecore.Services.GraphQL.Content.Queries.ItemQuery, Sitecore.Services.GraphQL.Content" />
                  <query name="sites" type="Sitecore.Services.GraphQL.Content.Queries.SiteQuery, Sitecore.Services.GraphQL.Content" />
                  <query name="templates" type="Sitecore.Services.GraphQL.Content.Queries.TemplatesQuery, Sitecore.Services.GraphQL.Content" />
                  <query name="search" type="Sitecore.Services.GraphQL.Content.Queries.SearchQuery, Sitecore.Services.GraphQL.Content" />
                </queries>

How come my basic search gives an error? Is there something I'm not seeing?

0

Check if the configuration you supposed is realy used?

  • First be sure you deployed the config to all Sitecore servers, the jss deploy config, is only deploying the config to the CM server, not the CD if you have separated servers.

  • With the url /sitecore/admin/showconfig.aspx you can display the compiled configuration, make sure the search is in your GraphQL endpoint, There may be old or other config files that will destroy your search configuration.

  • Be sure you use the endpoint, with

<GraphQL> <endpoints> <yourendpointGraphQLEndpoint> <schema hint="list:AddSchemaProvider"> <queries hint="raw:AddQuery"> <query name="search" type="Sitecore.Services.GraphQL.Content.Queries.SearchQuery, Sitecore.Services.GraphQL.Content" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.