May 25 / Michiel

FullTextSqlQuery Exception from HRESULT: 0x80040E60

After upgrading a webpart from SharePoint 2007 to 2010 I got a exception from de search engine about the query format. I used the following code:

var sqlQuery = new FullTextSqlQuery(SPContext.Current.Site);
sqlQuery.ResultTypes = ResultType.RelevantResults;
sqlQuery.TrimDuplicates = false;
sqlQuery.QueryText = "SELECT Path, Title FROM scope() ORDER BY Title";

// Return the search results to a ResultTableCollection.
var results = sqlQuery.Execute();

When I debugged the code I found out that the ORDER BY clause was causing the problem. When I used a integer or date managed property in the order by clause the problem disappeared. I started investigating the options for text managed properties, in the properties for a managed property I found a new option:

image

The explanation for this option is:

To reduce storage requirements, new text properties are automatically treated as a hash which limits comparisons (including sorting) to equality/inequality.  Unselect this option to enable other types of comparisons (less than, greater than, order by).

When I enabled this option and started a full-crawl the problems are gone. In my opinion the error message should have been a bit more clearer.

2 Comments

leave a comment
  1. Marc / Sep 14 2010

    Hi
    I encountered the same issue. With the workaround to set “reduce storage” checkbox the exception does not occure anymore, but from my point of view, this is not an option. Becaus if you set this checkbox, then the sorting can not work correctly, because the fields can only be compared to equality (as the explanation of this checkbox mentions). However I tried it nevertheless but the search results get not sorted correctly which the “reduce storage” checkbox set.
    Can you confirm?

Trackbacks and Pingbacks

  1. Tweets die vermelden FullTextSqlQuery Exception from HRESULT: 0×80040E60 | SharePointBlog.nl -- Topsy.com
Leave a Comment

*