> 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: documentType(type: string) # Method package: wixSearch # Method menu location: wixSearch --> WixSearchBuilder --> documentType # Method Link: https://dev.wix.com/docs/velo/apis/wix-search/wix-search-builder/document-type.md # Method Description: Refines a search builder to only search for documents of the specified document type. The document type can be one of the following: + `"Site/Pages"` + `"Blog/Posts"` + `"Bookings/Services"` + `"Forum/Content"` + `"Stores/Products"` Setting the document type to `Site/Pages`: - Restricts the search to all regular and dynamic pages on your site that have [SEO indexing enabled](https://support.wix.com/en/article/enabling-search-engines-eg-google-to-find-your-site). Note that all Wix site pages are indexed by default. - Most main Wix app pages (for example, the Stores Shop page and the Blog Posts page) are included in the search. - App pages with content based on app collections (for example, individual Store products and Blog posts) are not included in the search. To search Wix app collection content, set the `documentType` to the corresponding app collection (for example, `"Stores/Products"`). - Custom router pages and some Wix app pages are not currently included in the search. - If the `documentType` is set to `"Site/Pages"`, you cannot [filter](wix-search.html#filter), [sort](#ascending), or apply [facets](#facets) to your search results. - Only the content of the `title` and `description` fields are searched. Setting the document type to a Wix app: - Restricts the search to the content of the specified Wix app collection, which also appear as pages on your site. For example, setting the `documentType` to `"Stores/Products"` restricts the search to products stored in the `"Stores/Products"` collection, which are also displayed in your site's Product Page. - The document properties returned in the search results differ depending on the supported schema for the specified `documentType`. - You can [filter](wix-search.html#filter), [sort](#ascending), and apply [facets](#facets) to selected fields based on the supported schema for each app. - For schema information see the following articles: - [Blog/Posts schema](https://support.wix.com/en/article/velo-wix-blog-schema-for-wix-search) - [Bookings/Services schema](https://support.wix.com/en/article/velo-wix-bookings-schema-for-wix-search) - [Forum/Content schema](https://support.wix.com/en/article/velo-wix-forum-schema-for-wix-search) - [Stores/Products schema](https://support.wix.com/en/article/velo-wix-stores-schema-for-wix-search) If the `documentType` is not specified, it defaults to `"Site/Pages"`. Note that you cannot chain multiple `documentType()` functions to search for multiple document types. Only the last specified document type will be searched. Deprecation note: `"Forum/Posts"` is no longer supported. Use `"Forum/Content"` instead. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Add a document type filter to a search ```javascript let newSearch = search.documentType("Bookings/Services"); ``` ## Create a search, add a document type filter, and run it ```javascript import wixSearch from 'wix-search'; // ... $w("#searchInput").onKeyPress((keyPress) => { if (keyPress.key === "Enter") { const phrase = $w("#searchInput").value; wixSearch.search(phrase) .documentType("Stores/Products") .find() .then( (results) => { if(results.documents.length > 0) { let documents = results.documents; } else { console.log("No matching results"); } }) .catch( (error) => { console.log(error); }); } }); ``` ## Build and run a search and display the results in a repeater ```javascript import wixSearch from 'wix-search'; // ... // Before search runs, set the repeater data as empty $w('#repeater').data = []; $w("#searchInput").onKeyPress((keyPress) => { if (keyPress.key === "Enter") { const phrase = $w("#searchInput").value; wixSearch.search(phrase) .documentType("Stores/Products") .find() .then((results) => { if (results.documents.length > 0) { $w('#repeater').data = results.documents; } else { console.log("No matching results"); } }) .catch((error) => { console.log(error); }); } }); $w("#repeater").onItemReady(($item, itemData) => { $item("#title").text = itemData.title; $item("#description").text = itemData.description; $item("#image").src = itemData.image; $item("#button").link = itemData.url; }); ``` ---