Search code examples
sql-serverfull-text-searchazure-sql-databasefreetext

SQL Server Full-Text search Empty catalog


I'm trying to get a full-text search running on SQL Server in Azure.

My data is in a varbinary(max) with all columns containing data. The data is strings of html.

The SearchableData column is computed and filled using:

CONVERT(VARBINARY(MAX),[Title] + [Body])

Doing a select and a convert back yields data.

I would like to utilize the built in html filter of SQL Server.

If I do the following I can search and everything works, however, without a filter:

CREATE FULLTEXT INDEX 
    ON ArticleContent (Body LANGUAGE 0, Title LANGUAGE 0) 
       KEY INDEX PK_ArticleContent ON AcademyFTS 
       WITH (STOPLIST = SYSTEM, CHANGE_TRACKING AUTO)

However, I want to be able to utalize the .html filtering.

I've created the following:

CREATE FULLTEXT CATALOG AcademyFTS WITH ACCENT_SENSITIVITY = OFF AS DEFAULT

and

CREATE FULLTEXT INDEX 
    ON ArticleContent (SearchableData TYPE COLUMN FileExtension LANGUAGE 0) 
       KEY INDEX PK_ArticleContent ON AcademyFTS 
       WITH (STOPLIST = SYSTEM, CHANGE_TRACKING AUTO)

However the catalog is empty and I don't get any results back from a simple search

SELECT * 
FROM ArticleContent 
WHERE FREETEXT(SearchableData, 'wiki') 

I've been using these two guides:

Hands on Full-Text Search in SQL Server

How to implement a full-text search on HTML documents with Microsoft SQL Server


Solution

  • I found the answer!

    You can't full-text search on a computed column! :)

    Microsoft Docs