Example redwoodjs search functionality with autocomplete

Hi,

I’m sort of lost on where to get started with getting Search up and running for my app.

Do I start with a Cell that has a Query and create a basic react component (Ex. input) on a page?

Anyone have a gist, github example I could take a look at?

Hello! If you take a look at the original example blog repo here, we have a very basic search: GitHub - redwoodjs/example-blog: Example Blog app written with Redwood

That repo hasn’t been updated in a while, but the core concepts of doing the search should still apply. In this case doing a search adds a term query variable to the URL, and then the SearchCell performs a Query using that variable: example-blog/SearchCell.js at main · redwoodjs/example-blog · GitHub

Let me know if you have any other questions!

@rob this is very helpful - thanks.

“then the SearchCell performs a Query using that variable” - Is it safe to say I can populate any autocomplete input of my choosing with the results that come back from this CELL?

You could have the Success component of the Cell render the input/autocomplete and have it be filled with the values that it got from the query, but if you keep typing in the box you need some way to trigger the query again. Off the top of my head the only way I can think to do that is have the text in the input be in state in a level above the cell, so that when it changes, the cell re-renders.

Thanks again… Will attempt and join office hours for additional questions

@rob - your response begs for the question “what about Algolia”?.

Do you see the Algolia based search fit for a different context, or maybe that solution was not available when advising @wbashir ?

I got the impression he was asking how to do it purely in Redwood, asking about cells and queries But yeah, Algolia is definitely an option, if you don’t mind relying on a third party service and potentially paying for it!

Thanks for your explanation @rob. The caveat you presented is a fair one, of course