Quick Question about API + Cross platform search

(Justin Veenema) #1

Hey @team!

Quick question about getting the Discourse API to work with our Universal Search. We just tried to get this working today, but the API isn’t actually letting us see the content. When we make the AJAX request, we get this:

We tried it on our local server and on a staging server, and still couldn’t get a response. The weird thing is that the Response Headers are returning an empty access-control-allow-origin

Can you guys point us in the right direction? We had this with our old Community and it drove a ton of useful traffic - so this would be pretty big for us. :slight_smile:


Cross Platform Search?
A way to include Discourse posts in Wordpress search results? Any clever ideas?
(cpradio) #2

I think you need to setup CORS which would be in the app.yml (search for CORS in that file).

Then there is a setting in Admin > Settings for CORS too where you can add your domain. I believe it may require a rebuild after updating that setting, but I’m not certain on that part.


(Rafael dos Santos Silva) #3

I have done this to integrate Discourse search with a big intranet portal and one thing I recommend is doing everything on the backend.

You can query multiple backends at the same time (using a parallel construct), and no need to expose API keys, endpoints and no CORS issues.


(Erlend Sogge Heggen) #4

@nikdavis if you’re available, maybe you could give us some insight into how New Relic incorporated Discourse into your “universal search”? Did you use one of the two methods listed above?

1 Like

(Nik Davis) #5

We implemented a tool to build a search index for our web properties, Swiftype.

You can control which URL patterns to scan, and meta tag each property, page, etc with detailed information in order to filter it. If you own many, diverse web properties a solution like this may make sense.

With that said, I’m not sure how helpful this info is in this context. :slight_smile:


(Justin Veenema) #6

We figured it out @nikdavis, @erlend_sh, @Falco + @cpradio!

Check it out in action here: http://academy.unbounce.com/

(Hint: Try searching something like Domain, SSL, etc.)


(Erlend Sogge Heggen) #7

For posterity’s sake, would you mind briefly explaining how you ended up implementing this?

Especially if you think it ought to be possible to do it an easier way (e.g. like you initially attempted it before you got blocked), we’d like to hear about it, since this is a recurring use case.


(system) automatically bumped #8

(Jeff Atwood) #9

Is this still functioning @Justin_Veenema? Which search terms will show it off?