> 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 ## Resource: wix-search ## Namespace: wix-search-filter-builder ## Article: Introduction ## Article Link: https://dev.wix.com/docs/velo/apis/wix-search/wix-search-filter-builder/introduction.md ## Article Content: # Introduction The `WixSearchFilterBuilder` functions enable you to create filters which can be used to refine search results. Specifically, you need `WixSearchFilterBuilders` to create compound filters for filtering a search with the `and()`, `or()`, and `not()` functions. You do not need `WixSearchFilterBuilders` for applying most filtering functions to a search. Instead you can chain [`WixSearchBuilder`](wix-search.WixSearchBuilder.html) filtering functions directly to your search. The following describes a typical filter builder flow: 1. Create a `WixSearchFilterBuilder` using the [`filter()`](#wix-search.html#filter) function. 1. Create a `WixSearchFilter` by applying a single `WixSearchFilterBuilder` filter function, such as `eq()` or `gt()`, to the filter builder. You cannot chain more than 1 filtering function to a `WixSearchFilterBuilder`. 1. You can use `WixSearchFilters` in one of 2 scenarios: + Create more filters: Pass one or more `WixSearchFilters` as parameters to an `and()`, `or()`, or `not()` `WixSearchFilterBuilder` function to create a new `WixSearchFilter`. For example, `newFilter = wixSearch.filter().or(filter1, filter2)`. + Refine a search: Pass one or more `WixSearchFilters` as parameters to an `and()`, `or()`, or `not()` `WixSearchBuilder` function to refine a search. For example, `newSearchBuilder = wixSearch.search().or(filter1, filter2)`. **Scenario 1: Create More Filters** In the following example we create filters and then join them to create an additional filter. The final filter contains functionality for searching for popular forum posts that have either more than 20 likes or more than 100 views. ```javascript import wixSearch from 'wix-search'; const filterBuilder = wixSearch.filter(); const gtLikeFilter = filterBuilder.gt("likeCount", 20); const gtViewFilter = filterBuilder.gt("viewCount", 100); const orFilter = filterBuilder.or(geLikeFilter, gtViewFilter) ``` At this point you can use the `orFilter` to either create additional filters or to refine a search. **Scenario 2: Refine a Search** In the following example we create filters and them pass them to an `or()` function appended to a search. We run a search for popular forum posts that have either more than 20 likes or more than 100 views: ```javascript import wixSearch from 'wix-search'; const filterBuilder = wixSearch.filter(); const gtLikeFilter = filterBuilder.gt("likeCount", 20); const gtViewFilter = filterBuilder.gt("viewCount", 100); wixSearch.search() .documentType("Forum/Content") .or(geLikeFilter, geViewFilter) .find() .then( (results) => { console.log(results.documents); } ); ``` Note that only some fields can be filtered. Check which fields can be filtered in the supported schemas for each [`documentType`](wix-search.WixSearchBuilder.html#documentType): - [Blog/Posts schema](https://support.wix.com/en/article/corvid-wix-blog-schema-for-wix-search) - [Bookings/Services schema](https://support.wix.com/en/article/corvid-wix-bookings-schema-for-wix-search) - [Forum/Content schema](https://support.wix.com/en/article/corvid-wix-forum-schema-for-wix-search) - [Stores/Products schema](https://support.wix.com/en/article/corvid-wix-stores-schema-for-wix-search)