Searchable Database possible?

I have been looking for a solution to have a dataset searchable by last name, first, name, province, etc., but can’t seem to find a way to make it work. I have asked a few people and I’ve been told it’s a Wix restriction. I found this video, Wix Code | How to Create a Search for Your Database - YouTube, but when I try it and preview, the search doesn’t work. Any advice would be appreciated. Thanks! Rene

@Rene

Yes its possible, what you want to do is run a search for each database field separately. You can then filter the dataset for all applicable results. Something like below…

import wixData from “wix-data”;

export function searchButton_click(event) {

console.log($w('#searchInput').value); 
filter($w('#searchInput').value); 

function filter() {

$w("#dataset1").onReady(() => { 

    $w('#dataset1').setFilter( 
        wixData.filter() 
        .contains("firstName", $w("#searchInput").value) 
        .or( 
            wixData.filter() 
            .contains("lastName", $w("#searchInput").value) 
            .or( 
                wixData.filter() 
                .contains("province", $w("#searchInput").value) 
            ) 
        ) 

    )

thanks mike! I think I may still have a parsing problem at the bottom. Does it look ok?

import wixData from “wix-data”;

export function searchButton_click(event) {

console.log($w('#input1').value); 
filter($w('#input1').value); 

function filter() {

$w("#dataset1").onReady(() => { 

    $w('#dataset1').setFilter( 
        wixData.filter() 
        .contains("Firstname", $w("#input1").value) 
        .or( 
            wixData.filter() 
            .contains("Lastname", $w("#input1").value) 
            .or( 
                wixData.filter() 
                .contains("cat1_name", $w("#input1").value) 
            )

add this

        ) 
    ) 
}) 

}
}

Thanks again. I had to play around with it a bit, and got the below code to work. How would I add another “.or”. I tried adding a third and it broke the code.
+++++++

import wixData from ‘wix-data’;

$w.onReady( function () {
//TODO: write your page related code here…

});

export function input1_keyPress(event, $w) {
let SearchValue = $w(“#input1”).value;
$w(“#dynamicDataset”).setFilter(wixData.filter().contains(“firstname”, SearchValue)
.or(wixData.filter().contains(“lastname”, SearchValue)));
}

import wixData from ‘wix-data’;

export function input1_keyPress(event, $w) {

let SearchValue = $w(“#input1”).value;

$w(“#dynamicDataset”).setFilter(

wixData.filter()     
.contains("firstname", SearchValue) 
.or( 
wixData.filter() 
.contains("lastname", SearchValue) 
.or( 
    wixData.filter() 
.contains("province", SearchValue) 
) 
) 
); 

}

Thanks, Mike! Very helpful

Hi there! I’m having trouble getting my database search code to work, can you help me out? When I preview all I can get it to show me is a blank table. I’m sure I’m doing something wrong with the code, I’m new to Java. This is what I have:

import wixData from “wix-data”;

export function SearchButton_click(event) {

wixData.query(“EventPhotos”)
.contains(“relatedjob”, $w(“#SearchInput”).value)
.contains(“description”, $w(“#SearchInput”).value)
.contains(“tags”, $w(“#SearchInput”).value)
.contains(“categories”, $w(“#SearchInput”).value)
.find()
.then(res => {
$w(“#ResultsTable”).rows = res.items;
});
$w(“#ResultsTable”).expand();
}

$w.onReady( function () {
$w(“#ResultsTable”).columns = [
{
“id”: “event”,
“dataPath”: “relatedjob”,
“label”: “Event”,
“width”: 500,
“type”: “string”,
“linkPath”: “EventPhotos/{Related Job}”
},
{
“id”: “thumbnail”,
“dataPath”: “thumbnail”,
“label”: “Photo”,
“type”: “image”,
“linkPath”: “EventPhotos/{Related Job}”
} //,
];
});

I am trying to create a searchable member directory. When a member signs up on my site I want to first be able to approve them. Then, once approved I would like the information they provided during the account member sign up form to be displayed in a directory. I would like each member to select a category for their listing from a drop down list of categories I have prepared. My website is for the BayportBluePoint.com chamber of commerce. I want community members to be able to search our directory of members for example: If I am looking for a lawyer I can visit the directory page and search “lawyer” in the search field. It would then return results for all the “lawyers” in my member directory. Can someone please provide step by step instructions? I have added Wix store to my site as we sell memberships and tickets to events so the contacts portion should already be usuable for this purpose… i think?!

Please open your own posts, instead of bumping up old ones !

And what you are describing looks like a job-request.

The Hollywood Lawyer .
On their website, visitors can find valuable resources and articles on entertainment topics that demonstrate the firm’s experience and commitment to education. The Hollywood Lawyer also maintains a blog, keeping readers informed of the latest developments and trends in the entertainment industry.

If you are a director, musician, actor, producer, or any other entertainment professional seeking top-notch legal representation, The Hollywood Lawyer is a trusted partner who understands the unique challenges and opportunities of the industry.