Unknown's avatar

Posts by Simon Doy

I am an avid SharePoint enthusiast who works as an Independent SharePoint Consultant based in Leeds, United Kingdom. I am one of the organisers of the Yorkshire SharePoint User Group in the United Kingdom. I have been designing and building SharePoint solutions since 2006.

>SharePoint Search IE Search Provider


>Today I’ve been playing around with IE Search Providers. The search provider functionality has been enhanced since IE7’s release.

The search box lives in the top right hand corner and Microsoft have provided a means for websites to create custom search providers. All the major search engines have them now, just take a look here http://www.microsoft.com/windows/ie/searchguide/en-uk/default.mspx?dcsref=http://runonce.msn.com/runonce2.aspx.

With this link you can create your own.

So that got me thinking and after a quick search other people have already done, as these things go when I follow peoples instructions it never works quite right. So here I will document what I did and the problems that I overcame.

So first of all how do you setup the search provider, the search provider functionality is created from an xml file which follows the OpenSearch schema. This xml file is used by a javascript function AddSearchProvider, which is part of the IE object model. The xml file describes the search provider and as you can see below has additional meta data to allow you to describe the search provider.

An example of the xml file is as follows:-

<?xml version="1.0" encoding="UTF-8" ?>
<opensearchdescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<shortname>iThink Search>/shortname>
<description>iThink Search provider</description>
<inputencoding>UTF-8</inputencoding>
<url type="text/html" template="http://sharepoint/SearchCenter/Pages/Results.aspx?k={searchTerms}&s=All%20Sites" />
</opensearchdescription>

In order to install the search provider we need to provide a piece of functionality to allow users to install the provider automatically.
This functionality is provided using a content editor web part.

So add a content editor web part to a page, create and upload an xml file based on the file above. A few notable points are regarding the URL tag, make sure that sharepoint is changed to your SharePoint’s server name, dns entry. The & should be an & as opposed to &. If it isnt then you will get an error when a user tries to add the search provider through javascript.

Also the xml file should be saved as ANSI, you can do this in the save as options for notepad. If not you will get a search provider couldnt be added error.

So what I did was upload the xml file into the top-level sites “Document” document library.

Going back to the content editor web part that was added earlier, edit the page and from the web part menu do edit->modify shared web part settings, click on the source editor button and copy and paste the following:-


<a href="#" onclick="window.external.AddSearchProvider('/Documents/searchprovider.xml')">Add SharePoint search to IE.</a>

Make sure you update the AddSearchProvider function call so that searchprovider.xml is the right name and maybe update the link text.

Click Apply down the bottom of the web part properties and then test out the link. If you get an error load the xml again and make sure that the double quotes etc are correct.

Hopefully now it should have added the search provider into IE. Test out the search function and make sure that it works…

Done! You now have the ability to search your SharePoint sites + any other content you are indexing from IE and it doesnt matter if you are logged into the site or not!

Superb!

Good luck….

>Getting all people to show in a Fixed Keyword Query


>Recently I have been playing around with the out of the box search web parts. As always its not really until you have a need do you start thinking about how you could do something.

Well one of my clients wished to get a list of all the people and display which languages they spoke. When I get around to it I will go over extending the User Profiles in more detail, to be fair there are plenty of examples on the web.

To help you understand what I am doing, create a new page and add a People Search Core Results web part. Modify the web part settings and click on Fixed Keyword Query.
This is where we can get the web part to display the results automatically.

You fill in a query such as: Bob click Apply and if any of your users have the word Bob in their profile they will show.

You also need to change the Cross-Web Part query ID to a non User Query, I use Query 2.

Anyway one of the things with a fixed keyword query is that you cannot submit a wildcard query. For example: FirstName:*

If you try this then you will get a message saying that the only search terms were wildcard or something like that.

Ok so how do we get all the people to show?
However you can do the following you can query to show using the content class property.
Therefore put in the following query: contentclass:urn:content-class:SPSPeople
Click Apply and low and behold all the users popup.

Then I had to manupulate the properties that were selected and also update the XSLT.. bobs your uncle it works.

But how did you find out the Content Class?
Well I wrote a little web part which pulled out the ContentClass property.
You could extend the Selected Columns and then manupulate the XSLT. I will update this post at a later date and talk about this.

In the meantime try it out.