Search for results
Query parameters
Attributes to filter search results
Text to search
"florence apartments"
When any value is passed, it enables the fuzzy search: the Levenshtein Edit Distance is used to match more results.
The search index ID on which the search will be performed. If not provided, the first enabled search index will be used.
"12345"
Restrict the search on pages in a specific locale
"it"
The build trigger ID or name on which the search will be performed.
Use search_index_id instead: this parameter is only supported for backward compatibility and will return an error if the build trigger has multiple search indexes associated.
"44"
Parameters to control offset-based pagination
The (zero-based) offset of the first entity returned in the collection (defaults to 0)
200
The maximum number of entities to return (defaults to 20, maximum is 100)
Returns
Returns an array of resource objects of type search_result
Examples
import { buildClient } from "@datocms/cma-client-node";
async function run() { const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });
// iterates over every page of results for await (const searchResult of client.searchResults.listPagedIterator({ filter: { query: "florence apartments" }, })) { // Check the 'Returned output' tab for the result ☝️ console.log(searchResult); }}
run();