Sunday, February 27, 2022

Troubleshooting Sitecore GraphQL search query- Part-1

Sitecore GraphQL is one of my recent favorites, and I would love to play around with it. I have faced a scenario that I wanted to blog about it.

Use case:

     My Sitecore application has numerous articles and the requirement is to fetch the articles based on certain conditions using Sitecore GraphQL.

Problem:

    Articles created in the Sitecore by the authors are not the exact results displayed on the webpage.          

   What can cause the items missing?

                         


                               

  Yes, even I had similar questions, when I saw the items mismatch between the results displayed and Sitecore content. 

Solution: 

    I have found one of the techniques to troubleshoot what could be the cause for the incorrect results.  Assuming all the contents were published and in an approved state.




 

Step-1:  Get the query used in the GraphQL

Step-2:  Use the same Query SOLR index and check if both the results returned in GraphQL and SOLR query is the same.

Step-3: Most probably if you are pointing to the right SOLR it will be the same result. If not check your SOLR endpoint.

Step-4: If SOLR and GraphQL return the same result, then the item does not get indexed. In this case, re-indexing would be the solution. 

I will also cover how to troubleshoot those with the sample query examples in the upcoming series.

No comments:

Post a Comment