I am trying to get data in my jss app from search using a solr index with the following query..

menuItem: search(index:"sitecore_breadcrumb_index",
    rootItem:"/sitecore/content/src/home/",first:5){ 
    results
    {      
      items
      {
        name
        templateName         
        item
        {           
          children{
            displayName
            url
            path
          }
        }
      }
    }    
  }

I get only null values during implementation..

          <ul>
            {menuItem.results.items.map((child) => (
              <li>
                {/* <RouterLink to={child.url}>{child.pageTitle.value}</RouterLink>  */}
                <Text field={child.name} />
              </li>
            ))}
          </ul> 

Though in query builder I am able to fetch data. Please help. Thanks.

  • 1
    Just to double-check: Are your items published and are they showing in the correct index for the site you are looking at? – Jay S Oct 5 at 12:52
  • Definitely check the network tab of your browser on page load, to see what the GraphQL network request payload/response is. If that doesn't help, at a minimum we'll need to know the framework you're using with JSS, and whether you're using integrated or connected GraphQL. – Kam Figy Oct 5 at 20:55
  • I did setup for xGraph query browser and I am able to fetch items with the same search query. More over I am using master database and my index was correct. – Saurav Oct 8 at 5:44

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.