creating search in database and display result on separate page

Hi All,

I want to search for a name in database using searchbar on homepage and display results on a separate page, I have done this by creating a database, a search bar (using user input text field with an icon) on homepage and a separate page (called results page) which have a repeater element on it.
Now
I am using below code on homepage and a separate code on results page

import {local} from ‘wix-storage’;
import wixLocation from ‘wix-location’;
$w.onReady( function () {
});

export function searchButton_click(event) {

let word = $w(“#searchBar”).value;
local.setItem(“searchWord”, word);
wixLocation.to(‘/results’);
}

I have achieved the results but my concern is the mouse click event.
export function searchButton_click(event)
I want people to get search result when they type the word in search bar and hit enter as currently after typing the word we need to click on search icon and the results are displayed.

I tried adding an event handler on user input field
export function searchBar_keyPress(event)
but this doesn’t give results

Have a read of this very recent forum post as the solution will be shown here towards the bottom of it.
https://www.wix.com/corvid/forum/community-discussion/trigger-button-click-using-enter-key

Also, depending on how much the user is entering in your search bar, you should be looking at giving the input a few milliseconds to catch up.
https://www.wix.com/corvid/forum/corvid-tips-and-updates/give-the-textinput-onkeypress-function-some-time

It sounds like you are making up something similar to the Wix Site Search app, which unfortunately is not able to be used with Corvid as of yet.
https://support.wix.com/en/article/about-wix-site-search