> 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: query(phrase: string) # Method package: wixSearch # Method menu location: wixSearch --> WixSearchBuilder --> query # Method Link: https://dev.wix.com/docs/velo/apis/wix-search/wix-search-builder/query.md # Method Description: Sets the search phrase to search for. The `query()` function provides an alternate method for setting the search phrase for your search. Instead of setting the search phrase directly as a parameter of the [`search()`](wix-search.html#search) function, you can set the search phrase using the `query()` function chained to a `WixSearchBuilder`. Setting the search phrase with `query()` allows you to build searches dynamically. For example, you could use a different search phrase depending on whether a specific condition is met. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Add a query to a search ```javascript let newSearch = search.query(phrase); ``` ## Build and run a dynamic search ```javascript import wixSearch from 'wix-search'; // ... $w("#searchButton").onClick(event => { const dropdownValue = $w("#myDropdown").value; const freeText = $w('#myInput').value; let searchBuilder = wixSearch.search(); if (dropdownValue) { searchBuilder = searchBuilder.query(dropdownValue); } else { searchBuilder = searchBuilder.query(freeText); } searchBuilder .find() .then((results) => { if (results.documents.length > 0) { let documents = results.documents; } else { console.log("No matching results"); } }) .catch((error) => { console.log(error); }); }); ``` ---