> 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: searchFields(fields: Array) # Method package: wixSearch # Method menu location: wixSearch --> WixSearchBuilder --> searchFields # Method Link: https://dev.wix.com/docs/velo/apis/wix-search/wix-search-builder/search-fields.md # Method Description: Refines a search to include only certain fields. The `searchFields` function refines a `WixSearchBuilder` to search only in the specified collection fields. The `title` and `description` fields are searchable for all document types. To find out which fields are searchable for other document types, 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 `searchFields()` isn't called or is called without an argument, the search includes all searchable fields. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Add a search fields filter to a search ```javascript let newSearch = search .documentType('Stores/Products') .searchFields(['sku']); ``` ## Create a search builder, add a search fields filter, and run it ```javascript import wixSearch from 'wix-search'; // ... wixSearch.search('phrase') .documentType('Stores/Products') .searchFields(['title']) .find() .then((results) => { const firstId = results.documents[0]._id; const firstDescription = results.documents[0].description; console.log('Search results:', results); return results; }) .catch((error) => { console.error(error); // Handle the error }); /* Promise resolves to: * [ * { * "_score": 3, * "inStock"*: true, * "_updated": "2022-05-18T11:00:23.615Z", * "sku": "0006", * "infoSections": [...], * "url": "/product-page/i-m-a-product-9", * "documentImage": {...}, * "description": "A product description.", * "collections": [...], * "discountedPriceNumeric": 15, * "onSale": false, * "id": "7bb38a7a-70b7-9cf3-fc80-584205694465", * "documentType": "public/stores/products", * "currency": "EUR", * "title": "Product Title" * } * ] */ ``` ---