Search in a dynamic page

I have a dynamic page that shown by category.
I want to add search but only in the specific category.
I have search bar but when I search it shows items from the whole database and not from a specific category.

There is a way to do it?

Thank you!


did you implement your own search code over your collection? can you please share the site url and code sample?


did you try something like this but with the category also in context?

export function searchButton_click_1() {
.contains(‘title’, $w(‘#textInput1’).value)
.then(res => {
$w(‘#resultsTable’).rows = res.items;

This is the code i used:

import wixData from ‘wix-data’;

// For full API documentation, including code examples, visit

$w.onReady(function (){
//TODO: import wixData from ‘wix-data’;

export function searchButton_onClick (){
.contains(‘City’, $w(‘#input1’).value)
.contains((‘title’), $w(‘#input1’) .value))
.then(res => {
$w(‘#table1’).rows = res.items;

If i search it shows me all the data but i want the data just from the specific dynamic page


please refer to the following option to both use a single query rather than 2 db searches. and also add the category of the dynamic page to filter the data by its category.
btw, are you able to get the current category in context for the item the dynamic page is displaying using code?

can you please also share the url of the site you are trying to build?


Hay nevo,

I think you are missing another condition in your query - to filter the data by the current dynamic page.

It normally involve something like the following - in addition to your code above

   .contains('City', $w('#input1').value)
   .contains(('title'), $w('#input1')  .value))
   .eq('FIELD', $w('#DYNAMIC_DATASET1').getCurrentItem().FIELD)
  1. FIELD in the code above is the field you use to identify the relation between the dynamic page and the items you search.
  2. Note that you should write field names in lower case - just city, not City
  3. Note you do not need the parenthesis around the title field name ('title) - just use ‘title’

Thanks YOAV.
Can i contact you privately?