Wednesday, October 30, 2013

Limiting Search Results to a particular Site

To the end-user in SharePoint, the content structure is built up by Site Collections and Sites. A site collection, from the name, is a collection of sites, including one top-level site, and any number of sub-sites below.

See http://technet.microsoft.com/en-us/library/cc262410.aspx for more information on site collections and sites.

In most cases knowing this bit of information keeps you afloat, but it doesn’t take long before you try to do something not documented on office.microsoft.com, and you start seeing the word web used every now and then. You might know all of this already, but for reference to the unknowing here are the relationships:

Office.com documentation MSDN documentation
Site Collection SPSite
Site SPWeb

Being a developer I’m used to this and can quickly jump between the red and blue pill worlds, knowing when a Site means a site collection and when it means a single site (web).

And this is where the worlds collide this time in terms of Query Rules.

Tuesday, October 22, 2013

Adding freshness boost to SharePoint Online

Freshness formula for ranking modelsEvery once in a while I get questions about customizing the rank model in SharePoint 2013. While it has never been easy to tune a rank model, it was somewhat easier with FAST ESP or FAST Search for SharePoint as the rank values was not normalized and it was possible to interpret how the rank was calculated. This is why I created the FS4SP Query Logger, quite useful when dealing with FS4SP.

An often useful part of ranking results is freshness, meaning newer items are pushed somewhat up the compared to older items.

But that was then, and this is now. The rank models in SharePoint 2013 has changed a lot and the resulting rank numbers are now normalized with more than 10 decimals. The numbers in the model itself are not easy to understand and I briefly wrote about this in Rank models 2013 – Main differences from 2010. I still don’t have a Ph.D in math, and I will leave that up to the clever people at FAST/MS who created these new model with neural networks and all. It’s possible to write simpler static models with 2013, but I think I have decided to stay away from it as long as I can, and do rank tuning using the XRANK operator instead. If I ever get a case where changing the model is the only way I’ll sign up for a rank tuning course over at the powers that be - benefit of living in Oslo :)

Wednesday, October 9, 2013

Make sure your People Search is fuzzified

Topics covered in this post
  • Fuzzy name matching on people search
  • Setting default language of a search result web part
  • Using the &ql URL parameter to set query language
  • Using Reflector to figure out how it all works
If your users primary language setting in SharePoint is a minority language, this post is for you. If your primary language is one of the languages in the list further down, keep on reading as well to broaden your horizon.

Finding people is one of the most used search features in SharePoint, and spelling names is inherently hard as people choose just about all possible ways to spell their name.

As an example; my name is Mikael Svenson, where it’s more common to spell Mikael with ch instead of a k (Michael) and Svenson is most commonly spelled with two s’ in the middle (Svensson). This means a search for “Michael Svensson” should also match “Mikael Svenson”. This is where fuzzy name matching comes in.

Creating a site collection in 2010 mode in SharePoint 2013

Today I got phoned up by a friend who asked how on earth he could programmatically create a site collection in 2010 mode in SharePoint 2013. Why he wanted to do this I’m not sure, and it’s not the point of this post :)

It’s actually quite easy if you look at the documentation of some of the SPSiteCollection.Add() methods which take an int as a compabilityLevel parameter. Passing in 14 in this parameter will ensure you get the 2010 look and feel. For reference the SPSite.SelfServiceCreateSite() method has similar overloads.

SPWebApplication webApp = new SPSite(http://host).WebApplication;
SPSiteCollection siteCollections = webApp.Sites;
uint lcid = 1033;
int compatLevel = 14;
string webTemplate = "STS#0";
SPSite newSiteCollection = siteCollections.Add("sites/test", "Title", "Description", 1033, compatLevel, webTemplate,
 "DOMAIN\\User", "Name", "Email_Address", "DOMAIN\\User", "Name", "Email_Address");

If you want to do it I PowerShell you can use the following command:

New-SPSite -Url http://host/sites/test -OwnerAlias "DOMAIN\User" -Template "STS#0" -CompatibilityLevel 14

And via Central Admin:

image

Friday, October 4, 2013

Migrating content from SharePoint 2010 on-premises to Office365–a non-working approach

Disclaimer: This post describes a failed attempt to streamline the migration of an on-premises 2010 site to a SharePoint On-line (2013) site without the help of 3rd party tools.

When you have some spare time it’s good to dog food what you preach. And we preach a lot to customers about options of migrating from SharePoint 2010 to SharePoint 2013. There are no silver bullet approaches to this as far as I know (and feel free to prove me wrong), so I thought I’d try what I call the Lazy Consultant approach to this.

This approach involves saving a site as a template with all the content included, then “fixing” the wsp file, and uploading it into SPO where you create a new site based on the uploaded template.

Search UI matters!

I’ve recently been tasked to optimize a search result page for a customer, as they have a “feeling” it’s not working out. For the record, I did not create the existing layout; if I did I would not write this post :)

The lesson to be learned is: Keep your UI clean, remove the clutter, and stick to science

I’ve long learned long ago that UX is very subjective and often emotionally loaded, and I do now want to force my views onto others without some backing. First off I got hold of the web server logs and wrote a small utility to parse out all the search queries going back a couple of months. By looking at the query strings I could easily pinpoint where in the UI people were clicking, thus providing me documented metrics on what parts of the current UI works, and which ones doesn’t.

Note: There is no out-of-the-box way of measuring where a user click in SP2010 or SP2013 search, so you have to figure out a way to do this yourself by either adding script and custom logging to the page, or parse the IIS logs as I did.