Search code examples
sql-serverfull-text-searchfulltext-indexfull-text-catalog

SQL Server Full-Text Search not working on PDF File


My full text search works with doc and docx but not working with pdf. The filters have pdf fullpath: C:\WINDOWS\system32\Windows.Data.Pdf.dll version: 6.2.19041.1023 Tell me what could be the matter?

CREATE TABLE [dbo].[FilesSearch](
    [id] [bigint] IDENTITY(1,1) NOT NULL,
    [rConclusionCard] [bigint] NOT NULL,
    [rConclusionCardFile] [bigint] NOT NULL,
    [FileAgreementContent] [varbinary](max) NOT NULL,
    [FileAgreementName] [nvarchar](255) NOT NULL,
    [FileExt]  AS (lower(reverse(substring(reverse([FileAgreementName]),(0),charindex('.',reverse([FileAgreementName]))+(1))))),
 CONSTRAINT [PK_ASM_CONCLUSIONCARD_FILESSEA] PRIMARY KEY CLUSTERED 
(
    [id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Index [UI_ConclusionCardFile]    Script Date: 13.03.2022 22:07:57 ******/
CREATE UNIQUE NONCLUSTERED INDEX [UI_ConclusionCardFile] ON [dbo].[FilesSearch]
(
    [id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object:  FullTextIndex     Script Date: 13.03.2022 22:07:57 ******/
CREATE FULLTEXT INDEX ON [dbo].[FilesSearch](
[FileAgreementContent] TYPE COLUMN [FileExt] LANGUAGE 'Russian')
KEY INDEX [UI_ConclusionCardFile]ON ([FTConclusionFileSearch], FILEGROUP [PRIMARY])
WITH (CHANGE_TRACKING = AUTO, STOPLIST = SYSTEM)

CREATE FULLTEXT CATALOG [FTConclusionFileSearch] WITH ACCENT_SENSITIVITY = ON 
AUTHORIZATION [dbo] 

Solution

  • It seems that your FileExt column was a bit off, and was adding in the .. So remove the + 1 from it.

        [FileExt]  AS (lower(reverse(substring(reverse([FileAgreementName]),(0),charindex('.',reverse([FileAgreementName])))))),
    

    Then rebuild the index

    ALTER FULLTEXT CATALOG FTConclusionFileSearch REBUILD;