Forum Documentation Showcase Pricing Learn more

Return search results of another page

Hi.

I would like to have a search bar (address) on the main page of the website + a search bar in a header, both returning results on the same page that I called (search results).

I initially created a “thing” called search but then I realized it would save of the search of the servers…

So, what is the best way to return results on a separate page?

Thanks!!

My understanding is you have a search bar with a “Search” button in different locations and when you click the button you want to open a page that displays the search results.

When you click the button, you’d send the text the user typed in the Search bar to the “Search results” page and have a Repeating Group there that displays the results.

You can open this page from any other page, header etc.

If you go to the dashboard you’ll find a super useful lesson: “Sending data to pages” that will show you how to do this. Let us know if that doesn’t suffice!

1 Like

See https://bubble.io/chapter?id=1380579009351x795796172693371800 as well - Chapter 4 in the documentation.

The issue with the above is that “Sending data to pages” sends a single thing, not a list.

If you want to show a set of search RESULTS, then it isn’t all that easy.

You can’t send the search term text, as it is not a thing.

You can’t do the search in the header (or page) and send the results, as you can’t send a list.

As per this thread…

You can’t have your “search results page” as a resusable element on every page either.

Unless I am missing something, then the only way I could get this to work was to store the search term on the user.

However, if there is an easier way than am all ears :ear:

Create a thing of type text called search query.
Send it to the search results page and use it to perform the query using a repeatable group there.
You can and most likely should have it on the user object.

Let me know if this makes sense.

Yes, you can either store the search result on the user, in which case you don’t need to send anything to the page as the user is referenced anyway.

Having a separate thing, linked to a user, is a nice way of doing it as you can then implement “search history”.

But to return to the original question, I don’t know a way to do it without storing the search term “on the servers”.

This is the way I did it, and instead of a seperate page, I have a results reusable element that overlays each page.

Store the search term on the User, then display the reusable element.

This has multiple tabs across different searches for things too. Works well and I don’t notice any lag with it being stored rather than passed.

I tried to create a Thing called “query” and send it to the “search result” page. I think it worked But it means that each query will be saved onto the database, right? I would like to avoid this.

I would like to just use the address typed by the user on the main page and display the results in a repeating group on another page (“search Results” page). Exactly like you can do when the search bar is on the same page as the repeating group displaying the results.

Yes that means this, but it shouldn’t be an issue. If your search is simple (like a string, etc.) you can also put that in the URL, and use this option https://bubble.io/reference#Data.DataSources.GetParamFromUrl

1 Like

How do you get it into the URL ?

You just use a link and define the URL manually. Something like

Website home/mypagename?search=Input’s value.

Using website home is important, as when you’ll be on your own domain name that’ll just work.

Storing searches cab be a very useful site use metric as you app matures, to understand users and their search patterns.

If you absolutely do not want to store that information for privacy reasons you can always delete it when the user moves away from the search page - there’s an action for that :wink:

2 Likes