Skip to main content
 
Go Search
Home
Categories
Bloggers
By: Thomas DuPont | Posted: March 30, 2011 at 5:30 PM

For my current project, our site collections had each their own vanity URLs. See here for the definition of a Vanity URL. In our case, we had a set of site collections URLs, each pointing to a product such as:

  • ProductA.company.com
  • ProductB.company.com
  • ProductC.company.com

In SharePoint 2007, using vanity URLs most of the time meant that you had to create your own HTTP module or buy some third party solution (or for free, see this project on codeplex). In SharePoint 2010, you can use a new feature called 'Host-named Site Collections' (see here for more details on msdn) to create vanity URLs, which simplify the whole process a lot. One limitation is that you will have to create your site collection through PowerShell and not through Central Admin.

Now, if you happen to have Claims Based Authentication enabled on your web application, you might have noticed that it's not possible to create a host-named site collection for that web application. You will run into this error 'New-SPSite : User cannot be found':

It took me a while to figure out that the issue was coming from the fact that I was using a claims based authentication web application and that the claims were enabled at the time of the site collection creation. There is a quick way around that issue by going to central admin and disabling your trusted identity provider:

.. and go back to PowerShell and re-execute your command which will create your host-named site collection successfully this time:

By: Thomas DuPont | Posted: March 30, 2011 at 5:27 PM

Working on a multilingual project, I had to come up with an approach for implementing resources values used across our UI solution on the SharePoint 2010 platform. Unlike for SharePoint 2007, there is more flexibility on the new 2010 platform to implement your resx files. I found that there were two approaches that can be used on order to deploy your Resource files using Visual Studio 2010 with SharePoint 2010.

Using the Empty Element

This is the approach I choose because it fit my requirements best. Using the Visual Studio templates, add a new 'Empty Element' to your project and call it 'Resources' (you can name it whatever you'd like):

In that folder, I added all my resx files that I will be using for my project:

For each resx file, make sure you update its properties. I have changed the deployment type to 'AppGlobalResource':

Using the mapped folder

For SharePoint specific resource files, it makes more sense to use the predefined 'Resources' mapped folder in the Visual Studio 2010.

Any resource files added to that mapped folder will be copied to the 14/Resources/ folder on the SharePoint server where the solution is deployed. If you wish to use that mapped approach but would like to have your resx files copied to the web application folder as well, you will need to edit the manifest.xml file and the ApplicationResourceFiles element to the <Solution> element such as:

<ApplicationResourceFiles>

<App_GlobalResourceFile Location="SharePointUI\Resources\Application.fr-FR.resx" />

<App_GlobalResourceFile Location="SharePointUI\Resources\Application.zh-CN.resx" />

</ApplicationResourceFiles>

By: Thomas DuPont | Posted: March 30, 2011 at 5:23 PM

With SharePoint 2010, it has definitely become easier to implement your own custom error page. Using the SPWebApplication.SPCustomPage enumeration, you can set your custom error page to override the default SharePoint one. Actually, you could do the same for your 'AccessDenied' or 'Login' pages. Here is the full list of out of box pages you could easily override and replace with your own custom ones:

Check out this blog for more information on how you can implement that SharePoint friendly approach.

For our project, we had to use different custom error pages depending on the error status code returned to us. In that case, overriding the default error page would not be enough and a proper alternative solution would probably be to create a custom http module in which you will redirect requests to your custom error page depending on their error status code. On our project, we decided to take a simpler approach which consists of creating an error handler in the Global.asax file that will catch all unhandled errors while processing a request (see here for example), here is how our code looked like:

 

void Application_Error(object sender, EventArgs e)

{

// Code that runs when an unhandled error occurs

 

int currentStatusCode = System.Web.HttpContext.Current.Response.StatusCode;

 

Server.ClearError();

 

switch (currentStatusCode)

{

case 404: Response.Redirect(ErrorPage404_Url);

break;

case 500: Response.Redirect(ErrorPage500_Url);

break;

default: Response.Redirect(ErrorPage_Url);

break;

}

}

By: Thomas DuPont | Posted: September 28, 2010 at 3:07 PM

I recently noticed an interesting behavior with the navigators in FAST ESP. Just as a refresher, navigators are used in FAST to allow users to quickly filter through results. Navigators facilitate that drill down/up mechanism on a set of search results.

On a project I am currently working on, I have been using FAST navigators so that users can filter the results by books. I created a navigator that contains the values of books and when a query is executed and comes back with results, I manipulated the book navigator so that the user could filter the results by book values (using the navigator modifiers).

Now one thing I noticed when passing in the modifier value (which contains the value of a book) in my code:

.. is that it's doing some sort of contain logic, meaning that if in your results set, the navigator modifier values starts or ends with the value you are passing in, it will find and give you back a subset of those matching results.

For example, I have two books called "Pédiatrie" and another one called "Maladies génétiques en pédiatrie". If I let the user click on a filter for the book "Pédiatrie", the value of the modifier will be set to "Pédiatrie" and subset of the results which will contain items for which the book navigator will match the value "Pédiatrie" should be returned. No! It will also return items for which the book navigator modifier value will match at the beginning and the end the value string "Pédiatrie". So in our case, results for both "Pédiatrie" and "Maladies génétiques en pédiatrie" are returned, which is not what the user is expecting.

I thought that maybe this could be a bug in the FAST API so I tested the query in the query server to see what kind of results would come back from there if I filter through using the same parameters:

As we can see in the results, two matches (not exact match!) come back:

Obviously, this creates some issues in terms of usability and functionality. Just be aware of the modifier behavior in the API when you design your filters and make sure you pass in a value that is unique enough so that an exact match is always returned. As an alternative solution, you could create an FQL query that targets specifically a field and proceed doing your filtering that way.

I updated FAST ESP to sp3 and this behavior can still be seen.

 

 

 

 

By: Thomas DuPont | Posted: September 24, 2010 at 6:16 PM

Having used SharePoint Search for a while, I got into the habit of quickly updating the noise words list by just updating the noise words list on the server without giving it too much thought. While working on a FAST ESP project, dealing with noise words seemed to be a bit more involved and the results might not always be what you were expecting.

One positive aspect is that there seems to be more than one approach to handle noise words in FAST ESP. You could use anti-phrasing, query side synonyms or IMS flows. All those approaches will remove noise words at query time which presents an advantage as no re-feeding is needed.

The best approach for this project it seemed was to use the anti-phrasing dictionary. Typically, anti-phrasing dictionary are storing irrelevant strings that might cloud the query such as "I am looking to search information on [relevant query words]." In our case, we wanted to target specific words considered as noise words by the business that might not necessarily be part of the out-of-the-box ant phrasing dictionary.

Our solution had to facilitate multiple languages, for that reason, we made sure to create an anti-phrasing dictionary per language. Each language would have its search profile in which the search view would point to a appropriate dictionary.

In order to feed the dictionary, I used the dictman tool, import your list of noise words into an existing or new dictionary.

create fr_antiphrases fr

import AP indep_antiphrases c:\noisewords.txt

Another tool I found useful was linguistics studio as I could go through a dictionary and verify if my values where inserted properly or I could just to see what values an existing dictionary had:

One last thing, you need to modify your query to enable spelling and force a rewrite of the query in order to have the noise words ignore at query time:

qtf_synonym:querysynonyms=true

spell=on

qtf_didyoumean:rewrite_post=value

 

Considerations:

After doing some investigation and looking at our results we decided not to remove noise words anymore and as it altered the results coming back to the users. If your search ranking is properly defined and set up, the right and relevant results should always show at the top of the search results page and irrelevant results will be dropped. As a best practice, it's preferred to let the user decide if a result is relevant or not to the search that was executed. Starting to alter the query can have negative effects on phrase queries. Phrase query is a query mode that can be used in FAST ESP that will look for an exact match to the user query. If we remove at query time some words we consider noise words, the user's query might never find a match if it happens that a noise word was used in the query though a real match could have come back in the results.

 

 About

 [more]

 Tag Cloud

 External Links

 ‭(Hidden)‬ Admin Links