| | TurboDB Studio | >TurboDB VCL < | roPTools | VDP | KALHelp | Downloads | Links | Suche | Kontakt | Impressum | |
|
Howto ... Create a Full Text index at runtime, using CreateTable()?
|
|
|
| ![]() |
|
The fulltext indexing is not supported for Unicode fields for TurboDB version 4.19 (and lower) and following workaround is needed. To create a fulltext index at runtime you have to perform the following steps: 1. Create the keyword table The structure has to be: string, smallint, autoinc: FIndexTable := TTdbTable.Create(nil); FIndexTable.DatabaseName := 'DB1'; FIndexTable.TableName := 'FTIndex'; FIndexTable.FieldDefsTdb.Add('Keyword', dtString, 30); FIndexTable.FieldDefsTdb.Add('Frequency', dtSmallInt); FieldDef := FIndexTable.FieldDefsTdb.Add('RecordId', dtAutoInc); FieldDef.Specification := 'Keyword'; FIndexTable.CreateTable; 2. Create the main table containing a relation field, the linked table is the keyword table: FMainTable := TTdbTable.Create(nil); FMainTable.DatabaseName := 'DB1'; FMainTable.TableName := 'FTMaster'; FieldDef := FMainTable.FieldDefsTdb.Add('RecordId', dtAutoInc); FieldDef.Specification := 'RecordId'; FMainTable.FieldDefsTdb.Add('Alpha1', dtString, 30); FMainTable.FieldDefsTdb.Add('Alpha2', dtString, 255); FMainTable.FieldDefsTdb.Add('Memo1', dtMemo); FMainTable.FieldDefsTdb.Add('Memo2', dtMemo); FieldDef := FMainTable.FieldDefsTdb.Add('Keywords', dtRelation); FieldDef.Specification := 'FTIndex.dat'; FMainTable.CreateTable; // tell the main table that there is a fulltext table FMainTable.FullTextTable := FIndexTable; 3. Call UpdateFulltextIndex method: FMainTable.UpdateFulltextIndex('Alpha1,Alpha2,Memo1,Memo2', 'Keywords', '', 1000); Tested with TurboDB 4 für VCL.
|