Freetext search multi-columns in c # (Linq)

1.8k Views Asked by At

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')

1

There are 1 best solutions below

2
Athii On BEST ANSWER

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