Item Search

The SDK provides a straightforward method to search for items on a specific page using an index ID and query parameters.

Search items using SDK

The getItems method fetches a list of items from a specified index using query parameters for search customization.

const queryParams = {
  limit: 10,
  cursor: "kjzl6...bgnc"
  query: "startup",
};

const items = await indexClient.getItems("ketb...osgnr", queryParams);

The response should look like this:

{
    "endCursor": "eyJ0e...daI19",
    "items": [
        {
            "type": "WebPage",
            "node": {
                "id": "kjzl6kcym7w8y5f1u...gigjo0x99",
                "title": "www.paulgraham.com | Essays",
                "favicon": "http://ycombinator.com/arc/arc.png",
                "url": "https://www.paulgraham.com/articles.html",
                "content": "If you're not sure which to read ... California RSS feed",
                "createdAt": "2024-07-01T20:44:51.307Z",
                "updatedAt": "2024-07-01T20:44:51.307Z",
                "deletedAt": null
            }
        }
    ]
}

Last updated