Skip to content

Algolia search tries to page past the limit, freezes UI #2603

@mootari

Description

@mootari

Describe the bug

Steps:

  1. Open https://npmx.dev/search?q=keyword%3Areact (list view)
  2. Open the network tab
  3. Scroll down until an Algolia request gets stuck in pending (after page 4)
  4. Observe that the UI stops responding and the tab freezes

Replaying the last POST request with curl returns a result that includes the following message:

you can only fetch the 1000 hits for this query. You can extend the number of hits returned via the paginationLimitedTo index parameter or use the browse method. You can read our FAQ for more details about browsing: https://www.algolia.com/doc/guides/sending-and-managing-data/manage-your-indices/how-to/export-an-algolia-index/#exporting-the-index-using-an-api-client

Full response
{
  "results": [
    {
      "hits": [],
      "nbHits": 224715,
      "offset": 1000,
      "length": 250,
      "message": "you can only fetch the 1000 hits for this query. You can extend the number of hits returned via the paginationLimitedTo index parameter or use the browse method. You can read our FAQ for more details about browsing: https://www.algolia.com/doc/guides/sending-and-managing-data/manage-your-indices/how-to/export-an-algolia-index/#exporting-the-index-using-an-api-client",
      "exhaustiveNbHits": false,
      "exhaustiveTypo": true,
      "exhaustive": {
        "nbHits": false,
        "typo": true
      },
      "query": ":",
      "params": "query=keyword%3Areact&offset=1000&length=250&analyticsTags=%5B%22npmx.dev%22%5D&attributesToRetrieve=%5B%22name%22%2C%22version%22%2C%22description%22%2C%22modified%22%2C%22homepage%22%2C%22repository%22%2C%22owners%22%2C%22downloadsLast30Days%22%2C%22downloadsRatio%22%2C%22popular%22%2C%22keywords%22%2C%22deprecated%22%2C%22isDeprecated%22%2C%22license%22%5D&attributesToHighlight=%5B%5D&facetFilters=%5B%22keywords%3Areact%22%5D&query=%3A",
      "index": "npm-search",
      "processingTimeMS": 29,
      "processingTimingsMS": {
        "_request": {
          "roundTrip": 26
        },
        "afterFetch": {
          "merge": {
            "entries": {
              "decompress": 8,
              "parse": 10,
              "total": 19
            },
            "mergeLoop": {
              "prepareNextHit": 21,
              "total": 21
            },
            "total": 22
          },
          "total": 22
        },
        "fetch": {
          "scanning": 3,
          "total": 4
        },
        "getIdx": {
          "load": {
            "total": 1
          },
          "total": 1
        },
        "total": 29
      },
      "serverTimeMS": 29
    }
  ]
}

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    backServer, Data

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions