How to create a search box with results from multiple query records

Repost from discord:

Hi guys, I’m looking to create a search input with results from multiple query records nodes, like to have the results come back with auto suggestions. Is there an example file I can dig through of something similar? Or how would you suggest approaching this? Thanks in advance for any response.

I created a simple example for you that you perhaps can start from.

This includes two components the Search Box and Search Box item. Here is an example of how I use it with two Query Records:

They are both triggered by the Do Search output, and the Search Text is used with the contains filter. The result is passed to a function node that merges the two arrays into one.

 var results = []
if(Inputs.FirstResults !== undefined)
    results = results.concat(Inputs.FirstResults)

if(Inputs.SecondResults !== undefined)
    results = results.concat(Inputs.SecondResults)

Outputs.Merged = results

You also need to change the Search Item to match how you want to display your search results.

I hope this give you a start!

Great, thanks Mikael, exactly what I needed to get started.

I have most of it up thanks, but I am having an issue with connecting the’search term’ to the query record.

Meaning I’m not sure how to plug a term in as a filtering mechanic.

Thanks in advance for any help

It’s a bit tricky, but you have to click the small “INPUT” label just above the “SearchName” in the filter box.

Screenshot 2022-07-27 at 09.22.50

This will give the Query Records node an input called SearchName, and the value of that input will be used in the filter.

The way you have it set up now it is searching for any firstName that contains the letters “SearchName”.

I was going mad on this one, thanks for clearing this up, works now.