Archive for May, 2010

Huge limitation in MOSS Search and Search Server Express using the FREETEXT clause

Sunday, May 23rd, 2010

A while ago I was working in a project where the customer had problem searching the content of columns with type multiple line of text in SharePoint. We were using the FullTextSqlQuery class with the FREETEXT keyword. After some investigation I found out that there is a huge limitation in the search engine. As it turns out when the crawler indexes content it stores the data in two columns in the MSSDocProps table. The first is strVal which is a nvarchar(64) and the second is binVal which is a image-type. When you run a fulltext query with the FREETEXT clause it runs against the strVal column which only contains the first 64 charcters of the crawled content.

This limitation got even more frusterating when we needed to search for document in a specific sub web. Since there is no way to search on the SPWeb’s guid we thought we could filter the search on the documents path put since this limitation also affects the CONTAINS clause we only got the first 64 characters of the url which was of no use.


The only workaround I’ve found is not to use FREETEXT and do some post-filtering of the dataset returned from ExecuteQuery. This is possible since the value of the fields you have in the SELECT clause fetches the data from the binVal column which contains the full text.

I understand that because of performance and disk space there is a limit of 64 characters but it would have been nice if Microsoft had made it possible to search the full content of a field.

SharePoint 2010 Foundation vs. Server

Wednesday, May 12th, 2010

Interested in what features are included in SharePoint 2010 Foundation and what’s not included. This is a really good summary:

Week number in Gantt view

Saturday, May 1st, 2010

I’ve already made previous post on how to add week number in the SharePoint monthly view of the calendar. This post is about how to add week numbers to the Gantt view. A customer wanted to display the headings in the Gantt view like YYWW (two digits representing the year and two digits representing the week number). This was solved using jquery and some date manipulation with javascript. The code runs on sites with English(american) regional settings but you can easily modify the script to run with other culture settings. Put the script in a content editor web part above the Gantt view or incorporate it into your master page.

Before adding the script:

After the script is added it looks like this:

Here is the script. Please change the protocol for the jquery script link depending on if you run http or https.

<script src="" type="text/javascript"></script>

<script type="text/javascript">

Date.prototype.getWeek = function() {
    var year = this.getFullYear();
    var month = this.getMonth();
    var day = this.getDate();

    month += 1; //use 1-12
    var a = Math.floor((14 - (month)) / 12);
    var y = year + 4800 - a;
    var m = (month) + (12 * a) - 3;
    var jd = day + Math.floor(((153 * m) + 2) / 5) +
                 (365 * y) + Math.floor(y / 4) - Math.floor(y / 100) +
                 Math.floor(y / 400) - 32045;      // (gregorian calendar)

    var d4 = (jd + 31741 - (jd % 7)) % 146097 % 36524 % 1461;
    var L = Math.floor(d4 / 1460);
    var d1 = ((d4 - L) % 365) + L;
    NumberOfWeek = Math.floor(d1 / 7) + 1;
    return NumberOfWeek;

$(document).ready(function() {

    function(intIndex) {
        var obj = $(this).attr("innerHTML");
        var firstDay = new Date(obj);

        if (firstDay.toString() != "NaN" && firstDay.toString() != "Invalid Date") {
            var week = firstDay.getWeek(firstDay.getDay());
            week = (week.toString().length == 1) ? '0' + week.toString() : week.toString();
            week = firstDay.getFullYear().toString().substr(2, 2) + week;
            $(this).attr("innerHTML", week);