{"id":532,"date":"2011-09-06T12:45:00","date_gmt":"2011-09-06T12:45:00","guid":{"rendered":"\/blogs\/bobb\/post\/Of-filetables-full-text-and-semantic-search-and-docidmaps.aspx"},"modified":"2011-09-06T12:45:00","modified_gmt":"2011-09-06T12:45:00","slug":"of-filetables-full-text-and-semantic-search-and-docidmaps","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/bobb\/of-filetables-full-text-and-semantic-search-and-docidmaps\/","title":{"rendered":"Of filetables, full-text and semantic search, and docidmaps"},"content":{"rendered":"<p>\nSQL Server Denali&#39;s new Filetable feature and full-text search are made for each other. Set up database for non-transactional filestream access with a directory name, create a table &quot;AS FILETABLE&quot; with a subdirectory name, drag over a bunch of files and turn on full-text search. Voila, instant search with two predicates and two TVFs. Even better, if you add the keyword SEMANTIC_STATISTICS after your column name in the CREATE FULLTEXT INDEX statement you have three new semantic search table-valued&nbsp;functions as well&nbsp;(provided that they&#39;re supported in your language). Add a property list and you can search on documents&#39; extended properties. What could be easier? Looks quite like the functionality of the long-forgotten WinFS, if you ask me (although I don&#39;t remember any Semantic Search in WinFS, just property search).\n<\/p>\n<p>\nThere&#39;s just one thing. Creating a fulltext index on using a FILETABLE uses an additional internal table the fulltext docidmap.The reason for this table is to map full-text&#39;s docid (an integer) to the the FTS index&#39;s key column. In the FILETABLE&#39;s case this would be the stream_id column, which as marked as a ROWGUIDCOL. CREATE FULLTEXT INDEX will use the ROWGUIDCOL column as a key column if you don&#39;t specify a key column. FTS uses the docid to do its lookup.\n<\/p>\n<p>\nBut&#8230;\n<\/p>\n<p>\nIn SQL Server 2008, an optimization was introduced if and only if the FTS index key column was an INT or BIGINT. In the case where FTS index key column is an INT\/BIGINT, no docidmap table is created when the FTS index is. Better yet, this optimization does away with the docidmap lookup step in the query plan. This step which basically adds another JOIN to every FTS and every Semantic Search query, is simply removed, improving the plan.\n<\/p>\n<p>\nBecause the FILETABLE&#39;s FTS key column is a UNIQUEIDENTIFIER, it can&#39;t take advantage of this optimization. You can&#39;t add columns to a FILETABLE either, so this isn&#39;t an option. Darn. One last question&#8230;because a UNIQUEIDENTIFIER (GUID) has a&nbsp; bigger value space than BIGINT, what happen&#39;s when you get more than VALUESPACE_OF(BIGINT) documents in your FTS\/Semantic corpus? Guess I&#39;d need to have over 18,446,744,073,709,551,616 documents to find out&#8230;wait, how many are on that C drive again?\n<\/p>\n<p>\n@bobbeauch<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SQL Server Denali&#39;s new Filetable feature and full-text search are made for each other. Set up database for non-transactional filestream access with a directory name, create a table &quot;AS FILETABLE&quot; with a subdirectory name, drag over a bunch of files and turn on full-text search. Voila, instant search with two predicates and two TVFs. Even [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,17,18,31,35],"tags":[],"class_list":["post-532","post","type-post","status-publish","format-standard","hentry","category-filestream-storage","category-filetable","category-full-text-search","category-sql-server-2012","category-sql-server-semantic-search"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.9.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Of filetables, full-text and semantic search, and docidmaps - Bob Beauchemin<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/bobb\/of-filetables-full-text-and-semantic-search-and-docidmaps\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Of filetables, full-text and semantic search, and docidmaps - Bob Beauchemin\" \/>\n<meta property=\"og:description\" content=\"SQL Server Denali&#039;s new Filetable feature and full-text search are made for each other. Set up database for non-transactional filestream access with a directory name, create a table &quot;AS FILETABLE&quot; with a subdirectory name, drag over a bunch of files and turn on full-text search. Voila, instant search with two predicates and two TVFs. Even [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/bobb\/of-filetables-full-text-and-semantic-search-and-docidmaps\/\" \/>\n<meta property=\"og:site_name\" content=\"Bob Beauchemin\" \/>\n<meta property=\"article:published_time\" content=\"2011-09-06T12:45:00+00:00\" \/>\n<meta name=\"author\" content=\"Bob Beauchemin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bob Beauchemin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/of-filetables-full-text-and-semantic-search-and-docidmaps\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/of-filetables-full-text-and-semantic-search-and-docidmaps\/\",\"name\":\"Of filetables, full-text and semantic search, and docidmaps - Bob Beauchemin\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website\"},\"datePublished\":\"2011-09-06T12:45:00+00:00\",\"dateModified\":\"2011-09-06T12:45:00+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/of-filetables-full-text-and-semantic-search-and-docidmaps\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/bobb\/of-filetables-full-text-and-semantic-search-and-docidmaps\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/of-filetables-full-text-and-semantic-search-and-docidmaps\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Filestream Storage\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/category\/filestream-storage\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Of filetables, full-text and semantic search, and docidmaps\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/\",\"name\":\"Bob Beauchemin\",\"description\":\"SQL Server Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e\",\"name\":\"Bob Beauchemin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g\",\"caption\":\"Bob Beauchemin\"},\"sameAs\":[\"http:\/www.sqlskills.com\/blogs\/bobb\/\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/author\/bobb\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Of filetables, full-text and semantic search, and docidmaps - Bob Beauchemin","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/bobb\/of-filetables-full-text-and-semantic-search-and-docidmaps\/","og_locale":"en_US","og_type":"article","og_title":"Of filetables, full-text and semantic search, and docidmaps - Bob Beauchemin","og_description":"SQL Server Denali&#39;s new Filetable feature and full-text search are made for each other. Set up database for non-transactional filestream access with a directory name, create a table &quot;AS FILETABLE&quot; with a subdirectory name, drag over a bunch of files and turn on full-text search. Voila, instant search with two predicates and two TVFs. Even [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/of-filetables-full-text-and-semantic-search-and-docidmaps\/","og_site_name":"Bob Beauchemin","article_published_time":"2011-09-06T12:45:00+00:00","author":"Bob Beauchemin","twitter_misc":{"Written by":"Bob Beauchemin","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/of-filetables-full-text-and-semantic-search-and-docidmaps\/","url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/of-filetables-full-text-and-semantic-search-and-docidmaps\/","name":"Of filetables, full-text and semantic search, and docidmaps - Bob Beauchemin","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website"},"datePublished":"2011-09-06T12:45:00+00:00","dateModified":"2011-09-06T12:45:00+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/of-filetables-full-text-and-semantic-search-and-docidmaps\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/bobb\/of-filetables-full-text-and-semantic-search-and-docidmaps\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/of-filetables-full-text-and-semantic-search-and-docidmaps\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/bobb\/"},{"@type":"ListItem","position":2,"name":"Filestream Storage","item":"https:\/\/www.sqlskills.com\/blogs\/bobb\/category\/filestream-storage\/"},{"@type":"ListItem","position":3,"name":"Of filetables, full-text and semantic search, and docidmaps"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/","name":"Bob Beauchemin","description":"SQL Server Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/bobb\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e","name":"Bob Beauchemin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g","caption":"Bob Beauchemin"},"sameAs":["http:\/www.sqlskills.com\/blogs\/bobb\/"],"url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/author\/bobb\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts\/532","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/comments?post=532"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts\/532\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/media?parent=532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/categories?post=532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/tags?post=532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}