SQL Server Full-Text AutoQuery

HI,

I’m trying to improve the performance of “Contains” AutoQuery searches against SQL Server 2014 for my service by using full-text indexing. I couldn’t find any decorators for Full-Text Indexing, so I tried to replace the default behavior by using a Template based on the CONTAINS keyword.

 [Route("/records/search", "GET")
 public class SearchRecords : QueryDb<RecordPoco>
    {
        [QueryDbField(Template = "CONTAINS({Field},{Value})", Field = "Name", ValueFormat="*{0}*")]
        public string NameContains { get; set; }

  }

… but calling /records/search?NameContains=foo returns a SqlException:

The argument type “nvarchar(max)” is invalid for argument 2 of “CONTAINS”.

I think it might be possible to override MaxStringLength of the provider (though I’m not sure of the exact syntax), but that’s probably not the right answer here. Any suggestions?

Try removing the ValueFormat, that’s generally only use for wildcards in LIKE searches.