Returns a list of search results matching your query.
By default, it returns 20 results. You can paginate the results using limit
and offset
parameters. In any case, a maximum number of 100 results is returned.
Attributes to filter search results
Attributes to manage results pagination
import { buildClient } from '@datocms/cma-client-node';async function run() {const client = buildClient({ apiToken: '<YOUR_API_TOKEN>' });// this only returns the first page of results:const searchResults = await client.searchResults.list({filter: {query: 'florence apartments'}});searchResults.forEach((searchResult) => {console.log(searchResult);});// this iterates over every page of results:for await (const searchResult of client.searchResults.listPagedIterator({filter: {query: 'florence apartments'}})) {console.log(searchResult);}}run();