Search code examples
c#linqfull-text-searchfreetext

Freetext search multi-columns in c # (Linq)


Is there the possibility by using EF.Functions.FreeText to search on multiple columns?

The function accepts as input parameters: the column in which to perform the search and the string to search for, but in the documentation I cannot find anything that makes me understand if I can execute it in this context FREETEXT ((col1, col2, col3), 'search')


Solution

  • You could use the && Operator to chain them

    _context.Foo.Where(x => EF.Functions.FreeText("Column1", "Search Text") && EF.Functions.FreeText("Column2", "Search Text"));

    If you want to do it dynamically I fear that you have to use FromSqlRaw