Language sensitive search results in SharePoint 

Tags: SharePoint

 

The Problem:

SharePoint returns different search results when I change my browser language

Searching for "the" in English will give no results because the word is ignored. 

Search results in English

Searching for "the" in Dutch does give results.

 Search results in Dutch

This is a feature of SharePoint, it's not a bug.

However, it's not always desirable behaviour. In a multi-lingual site with a variation for each language the search results should be in the language of the current variation.

By default SharePoint will ignore the variation settings and still take the browser language.

There are several posts with the same problem, here and herehere. The suggested solutions range from changing the browser language programmatically to creating a new masterpage with the Culture hard coded, to subclassing the search results web part and changing the Culture settings in the OnInit event.

Unfortunately these solutions either do not work or require a lot of work for a simple change.

The solution:

The Search Core Results web part has a property called "SearchLanguage", which holds the locale of the search results. By default this property is null, and the locale will be inferred from the browser language

To set this property to your language of choice, export the Search Core Results web part.

Towards the end of the file you'll find the property QueryLanguage, which is null by default:

<property name="QueryLanguage" type="string" null="true" />
 

Change this to

<property name="QueryLanguage" type="string">en-GB</property>
 

Now import the web part back to the page and remove the old Search Core Results web part.

The search results will now always be in the language you chose, no matter what the browser language is.

 
Posted by Mel Gerats on 4-May-09
1 Comments  |  Trackback Url | Bookmark this post with:        
 
ab

Comments


Jem Adler commented on Saturday, 23-Jan-2010
I just added the properties as mentioned above and in the url I have provided. However this solution only work when searchinh the whole site. Do you also have a solution to search "This Site" with a "hard-coded" language?

Your name  *
Email  *
Your URL 
Comment  *

Please enter the text from the image


Contact us - Raas Van Gaverestraat 83, 9000 Gent, Belgium - Tel. +32 (9) 330.15.00 - Privacy Statement - Sitemap - Sign In Developed with Microsoft Office SharePoint Server 2007