Permalink to Discourse search

We’re importing a Vanilla forum to Discourse; as part of this migration, I’m writing a PHP script to 301 redirect old Vanilla URLs to new Discourse URLs. I’ve got most of them hooked up properly, but I’m having trouble with search URLs. I don’t see a way to 301 redirect a user to a Discourse search result.

Search results for '' - Discourse Meta returns “200 OK” but displays a 404-ish error message, “The page you requested doesn’t exist or is private.” (That seems like a “soft 404,” a bug.)

How, if at all, can I link to a Discourse search result page?

4 Likes

There currently is no separate page for search, as the drop down at the top is the only user facing search mechanism. You could direct out to a google site search (see the 404 page for an example), or add in a route that populates the search bar.

Walk me through this from an end user perspective. I guess I’d link to https://meta.discourse.com/search?term=whatever, but that’s not what the URL bar would show, right? Would it do a redirect/replaceState to the root of the forum? But then open the populated search bar to show results?

That seems like a big limitation to me, although I like how it currently works UX wise but directly linking to a search is a good thing to have.

@dfabulich Your best bet might be creating a new standalone page if you have allot of pages indexed in google for this or rely on this type of feature e.g. members may have links inside of posts that are linking to search result pages.

2 Likes

That does seem like the best way, but it sounds like it may be too big of a feature for my first engagement with Discourse code.

I understand. If you are pressed for time you could create a non-ember.js page and just call the search routine and display the results (until you get a proper solution in place).

We don’t have a dedicated search page, it’s on our roadmap possibly in the next few months

8 Likes

We’d love to implement this on our Discourse. Any updates on this?

Dedicated search page is on my task list some time in the next 30-60 days

4 Likes

Echoing @lindseym, any updates on this?

No, this may be pushed back due to necessary infrastructure work (sysadmin technical debt). We need to have sites up and running and accessible for full page search to be relevant…

A search results page would greatly help with migrating other forums to Discourse by redirecting old URLs to searches for keywords in the post title.

1 Like

This now works:

https://meta.discourse.org/search?q=permalink%20search

6 Likes

Do we block the /search path via robots.txt? We better…

Yes

Disallow: /search
Disallow: /search/
1 Like