> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: data.items.search(dataCollectionId: string) # Method Link: https://dev.wix.com/docs/sdk/business-solutions/data/items/search.md # Method Description: Creates a search operation to find items in a database collection. The `search()` method builds a search operation to find data items in the specified collection based on text search and filter criteria. It returns a [`WixDataSearch`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-search/introduction.md) object that defines the search operation, which you can refine by chaining [`WixDataSearch`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-search/introduction.md) methods onto it. These methods define the search expression and mode, apply filters, and control sorting and pagination of search results. The methods chained to `search()` are applied in the order they are called. For example, if you specify an expression, apply filters, and then sort by a field, the search first finds items that match the expression and filters, and then sorts the results. Finally, to run the search, chain [`run()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-search/run.md) as the last method. The `search()` method runs with the following [`WixDataSearch`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-search/introduction.md) defaults that you can override: - `skip`: `0` - `limit`: `100` - `ascending`: by `_id` > **Notes**: > - Search operations are [eventually consistent](https://dev.wix.com/docs/sdk/backend-modules/data/eventual-consistency.md) and might not reflect recent changes. > - Searching isn't currently supported for [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections), [external collections](https://dev.wix.com/docs/develop-websites/articles/databases/external-databases/overview/integrating-external-databases-with-your-wix-site.md) or [Wix Blocks](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-blocks/about-wix-blocks.md). # Method Permissions: - Read Data Items # Method Permissions Scopes IDs: - SCOPE.DC-DATA.READ # Method Code Examples: ## Basic search example ```javascript import { items } from "@wix/data"; async function basicProductSearch() { const results = await items.search("Products") .expression("pizza") .limit(10) .run(); if(results.items.length > 0) { const items = results.items; const firstItem = items[0]; const hasNext = results.hasNext(); const hasPrev = results.hasPrev(); const length = results.length; } else { // handle case where no matching items found } } ``` ## Advanced search example ```javascript import { items } from "@wix/data"; async function advancedProductSearch() { const results = await items.search("Products") .expression("smartphone tablet") .orMode() .fields("title", "price", "category") .ascending("price") .run(); if(results.items.length > 0) { const items = results.items; const firstItem = items[0]; const hasNext = results.hasNext(); const hasPrev = results.hasPrev(); const length = results.length; } else { // handle case where no matching items found } } ``` ## default ```javascript try { } catch (error) { console.error(error); throw error; } ```