Need help with code!! Trouble with adding parameters on my database search filter.

On my real estate website ( https://www.dreamspotsrealestate.com/ ), I created a database of our rental properties. On the “Properties for Rent” page, I have a user input search bar that is working well with the code below:

let debounceTimer; 

export function searchINPUT_keyPress(event) {
 if (debounceTimer) {
        clearTimeout(debounceTimer);
        debounceTimer = undefined;
    }
    debounceTimer = setTimeout(() => {
        filter($w('#searchINPUT').value);
    }, 200);
}

let lastFilterTitle;
function filter(title) {
 if (lastFilterTitle !== title) {
    $w('#dataset1').setFilter(wixData.filter()
        .contains('title', title));
    lastFilterTitle = title;
    }
}

In the dataset I created a boolean field (“offMarket”) to check off which properties were no longer available. I have been having troubles trying to code the user search to account for these off-market properties.

Does anyone have any suggestions or feedback??

As you are using setFilter
https://www.wix.com/corvid/reference/wix-dataset.Dataset.html#setFilter

You might want to simply put into that filter a line that says not those that have the offMarket boolean value of true.
https://www.wix.com/corvid/reference/wix-data.WixDataQuery.html#not
https://www.wix.com/corvid/reference/$w.Checkbox.html#checked

I tried that but ran into problems since boolean values are tri-dimensional objects, so I can’t just check for true/false values. What specific line(s) of code would you add?

@bjd

Have a read of this previous post and see Nayeli’s reply to it.
https://www.wix.com/corvid/forum/community-discussion/empty-checkbox-in-database-is-not-false

@givemeawhisky @code-queen I read over the other post and Nayeli’s reply. It makes sense but I still cannot figure out how to adapt that to my code. Below I have included screenshots of the webpage and the dataset backend. When users search an address (e.g. "5120-26 S Michigan Ave), I need to only show properties that are NOT checked as “offMarket” (so only the 5 bed should show in the search results, not the 4 bed). How do I make this happen??

@bjd so add to your filter:

.ne("offMarket", true)

@jonatandor35 Thank you!! That worked.

@bjd you’re welcome. Happy to help.