XML : T-SQL Fulltext Index on only part of XML column

Consider the following table:

  create table Article  (      Id int identity(1, 1) not null,      Title nvarchar(255) not null,      Content xml  )    

I want to search the contents of the article, or its title, so I can create an index like this:

  create fulltext index on Article  (      Title,      Content  ) key index PK__Content__8675309    

With this index, I can easily query for articles that contain a specific word. Suppose I want to only look at part of Content for the index though? I'd like to do something like this:

  create fulltext index on Article  (      Title,      Content.query('/*:document/*:contentBody')  ) key index PK__Content__8675309    

Then fulltext search queries would only search Title and the node /document/contentBody in Content for words. But this syntax is not allowed. How can I do what I want to do here?

No comments:

Post a Comment