How to add a database field filter for search (using "standard" repeater search menu

Using searchbox/drop down for repeater filter. However, looking to narrow the search to specific area of database. One issue I am finding is that when search box is used it will pull search into the whole database (no matter if I use a filter on the dataset or not). So appears that using the code to set up the search boxes bypasses any filters set to the dataset.

So must set up filter within the code, but I am not much of a coder…so thoughts on how to add a filter to the “standard” code. Here is my specific code. I am wanting to filter the “category” field by specific input to that field. Say category has data of x in some, and b in some. I want to filter my search menu in this code to limit to only searching results that have x in category and not pull up all the other in database. Without such, the search attempts to pull all up all items in database and since items in repeater may not be applicable to all…it leaves an ugly page result and just an overall nuisance to a visitor.

import wixData from “wix-data”;

$w.onReady(() => {

let lastFilterReference;
let lastFilterCategory;
let debounceTimer;

export function iTitle_keyPress(event, $w) {
if (debounceTimer) {
debounceTimer = undefined;
debounceTimer = setTimeout(() => {
filter($w(‘#iTitle’).value, lastFilterCategory);
}, 500);

export function iCategory_change(event) {
filter(lastFilterReference, $w(‘#iCategory’).value);

function filter(title, category) {
if (lastFilterReference !== title || lastFilterCategory !== category) {
let newFilter = wixData.filter();
if (title)
newFilter = newFilter.contains(‘reference’, title);
if (category)
newFilter = newFilter.contains(‘category’, category);
lastFilterReference = title;
lastFilterCategory = category;

function loadMagPages() {
.then(res => {
let options = [{“value”: ‘’, “label”: ‘All Categories’}];
options.push(… => {
return {“value”: category.title, “label”: category.title};
$w(‘#iCategory’).options = options;


export function iTitle_change(event) {
//Add your code for this event here:


If you want limit the results by category, you can use some filters (in this case I’ll use dropdowns).
first I created a column in my database that will be a category. Then I added a dropdown to my site that will filter data from that column. So, I added a text input for the search and now I can code the search with a limit results according to the category I choose in the dropdown.

import wixData from 'wix-data'; 
export function button1_click(event, $w) { filter($w('#textInput').value, $w('#filterOne').value); 
function filter(titleText, category1) { $w('#dataset').setFilter( wixData.filter().contains('title', 
titleText).contains('category', category1) ); 

To learn more about the code and search/filter visit this link: