Search code examples
sqlsql-serverkeywordcontainstablefreetexttable

iFTS Free-Text SQL Server 2014 multiple columns multiples keywords


I am starting with FTS, and I just got stuck on a problem. When I try to search on my table using a Containstable, I cannot figure out how to make it search on every columns. It returns 0 element even if I know someone exists with this name.

ex:

Select [Id],[LastName], [Firstname] from Employee E
INNER JOIN ContainsTable(Employee, ([LastName], [Firstname]), '"firstname" AND "lastname"') as E1 on E1.[Key] = E.Id
ORDER BY [Rank] desc

It does work with OR but not with a AND operator.

If I use Freetexttable instead, it returns way too much employees and the operator words are not taken in account.

I read many post on Stackoverflow and and couldn't figure out the solution. I am looking to extend the data indexed in the table with a lot of information searchable but for the moment, I am just stuck with 2 fields.

I am looking forward your answers.


Solution

  • I found the solution it was a problem of configuration.

    exec sp_fulltext_database 'enable'

    Good luck!