Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The full-text query parameter for Fulltext Query String is not valid

I am using Full Text Search with LINQ in my application and as this is not supported by LINQ I use a table-valued function workaround. The function is created on SQL Server 2008.

Surprisingly, I get error “The full-text query parameter for Fulltext Query String is not valid” when I search for a simply text e.g. “manager”

I used SQL Server Profiler and found out that LINQ generated the parameter as nvarchar(4000) instead of nvarchar(250) which is in my function.

The biggest surprise came when I changed my SQL Server function so it accepts parameter as nvarchar(4000) instead of nvarchar(250) and the problem is solved.

I was also playing to change the parameter to nvarchar(2000) and less but this also didn’t work.

Does anybody know why this behaves this way?

Updated on 18th November 2013 - Good news and bad news

Good news - I am now using Entity Framework 6 for this particular example and it is not anymore needed to use nvarchar(4000)

Bad news - You have to use instead nvarchar(max) :-(

like image 588
Vaclav Elias Avatar asked Sep 22 '10 16:09

Vaclav Elias


2 Answers

For an expanation see the following link http://social.msdn.microsoft.com/Forums/en-US/linqtosql/thread/1a46d676-32f0-44a4-b39f-61a17bccb8e3/.

like image 141
AxelEckenberger Avatar answered Sep 24 '22 17:09

AxelEckenberger


In my case I had to force JAVA to call my Table-Value-Function with matching datatype as below

query.setParameter(0, variable, new **StringNVarcharType**()  )
like image 27
Ndjoumou Avatar answered Sep 21 '22 17:09

Ndjoumou