Friday, November 21, 2008

FullTextSqlQuery with QueryText max length issue

Hi all,

As mentioned in one of our previous post for search part 2
we are using FullTextSqlQuery object from Microsoft.Office.Server.Search.Query.

But we are facing problem for while creating query and assigning to QueryText method.

QueryText method accepts string object but it has a limitation.

You can assign maximum 4096 character string to QueryText.

We came to know about this by disassembling this DLL.

What we found is strange thing.

While setting QueryText property it will check

If object is type of FullTextSqlQuery then QueryText max length equals to 4096 char

Else if object is type of KeywordQuery then QueryText max length equals to 1024 char.

If length is more that this limit then it will give ArgumentOutOfRangeException();

We don’t know why is it so?

But just guessing that may be this limitation for rank optimization.

So conclusion is

FullTextSqlQuery QueryText should be < 4096 char
KeywordQuery QueryText should be < 1024 char.


Anonymous said...


is there a workaround to use the Sharepoint Search API with a string any length?

SharePoint Kings said...

nope no work around for this

Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to