j055
asked on
How can I stop XML elements being indexed when using SQL Server Full Text Search
Hi
I have Full Text Search enabled on a varchar(max) column. Some but not all rows contain XML in this column. I'd like to search for text using FT but ignore any XML elements. e.g.
SELECT Title, Text_1
FROM CmsContent
WHERE CONTAINS (Text_1, '"table" AND "tbody"' );
GO
should not return any results. The ideal solution would be to not index these elements in the first place. What are my options? I'm using SQL Server 2008
Many thanks
Andrew
I have Full Text Search enabled on a varchar(max) column. Some but not all rows contain XML in this column. I'd like to search for text using FT but ignore any XML elements. e.g.
SELECT Title, Text_1
FROM CmsContent
WHERE CONTAINS (Text_1, '"table" AND "tbody"' );
GO
should not return any results. The ideal solution would be to not index these elements in the first place. What are my options? I'm using SQL Server 2008
Many thanks
Andrew
ASKER
Actually I want to exclude xml elements from any FT search and only search the inner text of any elements. I just read this:
http://msdn.microsoft.com/en-us/library/bb522491.aspx
which says 'You can create a full-text index on XML columns that indexes the content of the XML values, but ignores the XML markup' so I guess your suggestion to move the content to it's own xml column type is the best way to go.
Thanks
Andrew
http://msdn.microsoft.com/en-us/library/bb522491.aspx
which says 'You can create a full-text index on XML columns that indexes the content of the XML values, but ignores the XML markup' so I guess your suggestion to move the content to it's own xml column type is the best way to go.
Thanks
Andrew
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Can't see why <root>plain text</root> can't work. I shall give it a go.
Cheers
Andrew
Cheers
Andrew
SELECT Title, Text_1
FROM CmsContent
WHERE CONTAINS (Text_1, '"table" AND "tbody"' );
and Text_1 LIKE '<%'