3

I want to update the search dropdown for one of my sites so that it can search google (as an example) for one of the options.

Right now I can enter http://google.com for the URL without any issue. When I run the search it generates the URL:
https://www.google.com/?k=TEST

I need it to generate the URL:
https://www.google.com/#q=TEST.

enter image description here

Question
Is there a way to add a token or modify the URL in a way so I can insert q instead of a k for the search term parameter?

  • Nice question, RWL01! It can be done using window.location.replace(...) – Benny Skogberg Dec 14 '13 at 21:24
  • Thanks for the hint but unfortunately SharePoint does not allow me to put any value that does not look like a URL (relative or absolute). – RWL01 Dec 14 '13 at 22:07
3

In SharePoint 2013 I would do this with a Result Source using Open Search against Google. (I have done this with Bing and MSDN for different portals, I expect that Google supports Open Search).

  1. Create a new Result Source and choose Open Search.
  2. I found a link for Google News, but don't have one for regular Google. http://news.google.com/news?hl=en-us&ned=us&ie=UTF-8&q={searchTerms}&output=rss Here is the format for Bing http://www.bing.com/search?q={searchTerms}&format=rssYou can download examples from SharePoint 2010 and just strip out the URLs from MSDN
  3. Leave the credentials as anonymous.

Next you have to choose how to employ it. You can create a new search page, add an additional web part, or (my preference) add a Query Rule that sends the users query to the Result Source.

  1. Create a new query rule on Local SharePoint Results
  2. Determine what will trip your rule (or remove the condition to always run it.) For example, if I have an MSDN rule I may choose to run it when I detect the action term "KB".
  3. Add a Result Block and select your new Result Source and the parameter for "Search this Source".
| improve this answer | |
  • Thanks for the answer. It looks like my method was not an enterprise solution and lacked the sophistication needed. My takeaway is that it's possible but I will need to depend on result sources for searches of this nature. – RWL01 Dec 15 '13 at 16:55
  • I believe you are correct. – Matthew McDermott Dec 16 '13 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.