Commit 71929d1
committed
Full-text catalog + index DDL surface — sixth bacpac prerequisite bundle, skip-with-diagnostic stance. CREATE/DROP FULLTEXT CATALOG + CREATE/DROP FULLTEXT INDEX parse-and-store;
**Storage**: new `FullTextCatalog` (`SqlServerSimulator/FullTextCatalog.cs`) — id + name + is_default + is_accent_sensitivity_on + principal_id + create_date. New `FullTextIndex` (`SqlServerSimulator/FullTextIndex.cs`) — catalog_id + key_index_name + unique_index_id + List<FullTextIndexColumn>; lives directly on `HeapTable.FullTextIndex` as a single nullable slot (real SQL Server's invariant: at most one FT index per table). `FullTextIndexColumn` readonly struct — column_id (1-based storage ordinal) + language_id + nullable type_column_id. `Database.FullTextCatalogs` is the per-database ConcurrentDictionary<string, FullTextCatalog> (case-insensitive); `Database.AllocateFullTextCatalogId` returns 5 first (Microsoft Learn documents ids 0..4 as reserved). The new `Fulltext` ContextualKeyword routes CREATE/DROP dispatch.
**Parsers** in `Simulation/Simulation.FullText.cs`:
- `CREATE FULLTEXT CATALOG name [AS DEFAULT] [AUTHORIZATION owner] [WITH ACCENT_SENSITIVITY = {ON|OFF}] [ON FILEGROUP fg] [IN PATH '…']` — filesystem-placement trailers parse-and-discard. AS DEFAULT demotes prior defaults before promoting. AUTHORIZATION resolves against `Database.Principals` (default dbo); unknown principal raises Msg 15151. Duplicate name raises Msg 2714.
- `CREATE FULLTEXT INDEX ON table (col [TYPE COLUMN typeCol] [LANGUAGE n] [STATISTICAL_SEMANTICS] [, …]) [KEY INDEX name] [ON catalog | ON (catalog [, FILEGROUP fg])] [WITH (option [, …])]` — full multi-column form, the AW Production.Document `body TYPE COLUMN file_ext` nested reference, LANGUAGE integer LCID, both paren and bare ON-catalog forms, and the WITH-options block via the shared SkipBalancedParens helper. Missing table → Msg 208. Twice-on-same-table → Msg 2714. Unknown column → Msg 207. Unknown key-index name → Msg 208. Omitted ON catalog falls back to the default catalog (Msg 208 if no default exists).
- `DROP FULLTEXT CATALOG name` / `DROP FULLTEXT INDEX ON table` — dedicated `TryParseDropFullText` ahead of the generic DROP-target switch (the sub-keyword grammar would otherwise misroute through the comma-list path).
**Predicate / rowset rejection**: `BooleanExpression.ParseAtom` intercepts the `Contains` / `FreeText` ReservedKeywords ahead of the comparison parse and raises NotSupportedException with `"Full-text search predicates ({CONTAINS|FREETEXT}) are not modeled."`. `Selection.ParseSingleFromSource` intercepts the rowset-function ReservedKeywords (ContainsTable / FreeTextTable / SemanticKeyPhraseTable / SemanticSimilarityTable / SemanticSimilarityDetailsTable) ahead of the syntax-error default with `"Full-text rowset functions ({CONTAINSTABLE|…}) are not modeled."`.
**Catalog views** in `BuiltInResources.cs`:
- `sys.fulltext_catalogs` (9-col): fulltext_catalog_id / name / path (NULL) / is_default / is_accent_sensitivity_on / data_space_id (NULL) / file_id (NULL) / principal_id / is_importing (false).
- `sys.fulltext_indexes` (14-col): object_id / unique_index_id / fulltext_catalog_id / is_enabled (true) / change_tracking_state ('A') / change_tracking_state_desc ('AUTO') / has_crawl_completed (true) / crawl_type ('F') / crawl_type_desc ('FULL') / crawl_start_date (NULL) / crawl_end_date (NULL) / stoplist_id (NULL) / data_space_id (NULL) / property_list_id (NULL).
- `sys.fulltext_index_columns` (5-col): object_id / column_id / type_column_id / language_id / statistical_semantics (false).
Column subset matches Microsoft Learn's documented surface for SQL Server 2022+ (the reference SQL Server 2025 instance doesn't have Full-Text installed — the catalog views aren't registered without the FT service, so probe-confirmation isn't available; column types are from learn.microsoft.com/sql/relational-databases/system-catalog-views/).
21 new tests across `FullTextDdlTests.cs` (17) + `FullTextPredicateTests.cs` (4): catalog AS DEFAULT semantics + accent-sensitivity flag / duplicate-name Msg 2714 / drop happy + missing Msg 208 / default-promotion demotion; index single-col / multi-col with TYPE COLUMN matching AW Production.Document / default-catalog fallback resolution / missing table Msg 208 / duplicate-on-table Msg 2714 / unknown column Msg 207 / unknown key-index Msg 208 / row shape (is_enabled / has_crawl_completed / change_tracking_state_desc / crawl_type_desc) / principal_id pre-seed round-trip; predicate + rowset NotSupportedException verification for all four predicate / rowset forms. Test counts: 4141 main (+21 new) / 227 internal / 328 EFCore / 58 analyzers — all green Debug + Release.
`docs/claude/bacpac-prerequisites.md` flips the Full-text checklist item to [x] with the full implementation walkthrough; the order-of-operations sequence absorbs the merged item. `CLAUDE.md` shrinks the BACPAC prerequisite list to just xml + spatial and gains a new Feature-reference index entry for the full-text DDL + catalog-view surface; the "Working on BACPAC import support" entry's shipped-prerequisites paragraph now lists full-text alongside the other six landed items.
**Deferred**: query-time text search (the tokenizer/stemmer/inverted-index/relevance-rank pipeline) — out of scope as the prereq doc called for. ALTER FULLTEXT CATALOG / INDEX (REORGANIZE / REBUILD / START/STOP POPULATION / ADD/DROP column) — currently raises a syntax error since no ALTER path exists. The legacy `sys.fulltext_languages` / `sys.fulltext_document_types` / `sys.fulltext_stoplists` lookup catalogs aren't shipped — apps that introspect the language enum hit a missing-view error.sys.fulltext_catalogs / sys.fulltext_indexes / sys.fulltext_index_columns catalog views ship; CONTAINS / FREETEXT / CONTAINSTABLE / FREETEXTTABLE / SEMANTIC* all raise NotSupportedException at parse time. AW model.xml's 1 SqlFullTextCatalog ([AW2025FullTextCatalog]) + 3 SqlFullTextIndex elements round-trip end-to-end; the existing uspSearchCandidateResumes proc body parses through CREATE PROCEDURE verbatim and fails loudly on EXEC — exactly the skip-with-diagnostic stance the prerequisites doc called for.1 parent 8e1b7f3 commit 71929d1
15 files changed
Lines changed: 1130 additions & 15 deletions
File tree
- SqlServerSimulator.Tests
- SqlServerSimulator
- Parser
- Simulation
- Storage
- docs/claude
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
163 | 164 | | |
164 | | - | |
| 165 | + | |
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
0 commit comments