Ok here is how I solved this problem:
It turns out that google has a lost API (probably deprecated so be aware of this) for client-side ajax search. It looks like that:
http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=test&rsz=large
Just go to that url to see what results it gives.
So basically here is the process:
- The user types a search
- It is sent to your server in ajax
- The server might modify the search depending on your application (filtering forbidden words or whatever)
- Your server polls the ajax web service from google - don't forget to add the
get
parameteruserIp
which is needed to avoid limitations (google limits incoming queries from each user, so your server has to tell google that it is making a request on behalf of thisuserIp
- You send back the results to the client, and then use javascript to display them
The only drawback is that the search must be made in ajax, meaning that the page is empty at load and filled later. But you could actually use get parameters in URL to preload the search and fill the page before sending it to the client though.