Query returns empty hits

Hi there,

We’re troubled about a query problem. Often times, the search API does not return a value despite having a lot of searchable data.
It will recover after a while, but in the meantime, it’s annoying our customers. Do you have any solutions?

When not working

{
    "results": [
        {
            "hits": [],
            "page": 0,
            "nbHits": 0,
            "nbPages": 0,
            "hitsPerPage": 20,
            "exhaustiveNbHits": true,
            "processingTimeMS": 1,
            "query": "m",
            "params": "highlightPreTag=%3Cais-highlight-0000000000%3E&highlightPostTag=%3C%2Fais-highlight-0000000000%3E&query=HP&facets=%5B%5D&tagFilters=",
            "index": "prod_SUPPORT"
        }
    ]
}

When successful

{
    "results": [
        {
            "hits": [
              {...
            ],
            "nbHits": 338,
            "page": 0,
            "nbPages": 17,
            "hitsPerPage": 20,
            "exhaustiveNbHits": true,
            "query": "m",
            "params": "highlightPreTag=%3Cais-highlight-0000000000%3E&highlightPostTag=%3C%2Fais-highlight-0000000000%3E&query=m&page=0&facets=%5B%5D&tagFilters=",
            "index": "prod_SUPPORT",
            "processingTimeMS": 1
        }
    ]
}

We are using Gatsby and contentful.

Hello @e.ishiguro,

Sorry to hear you are experiencing this issue of empty result sets. Without more information, it’s difficult to tell what may be wrong here. A first recommendation I could give you would be to check how you are performing re-indexing operations. Indeed, if your indices are empty at the time you perform a search request, because a re-indexing operation is hapenning on your end which clear the data, this may be an issue.

To better confirm this, could you either:

  • share here on Discourse what your indexing implementation look like
  • and/or send us a support ticket at support@algolia.com with your application ID and ideally with support access (via https://www.algolia.com/account/support) for us to investigate the what operations may have caused an empty result set on your end.

Best regards,

@anthony.seure Thank you for the reply.
We will investigate our indices and try to contact support! :smile: