Setting Up a Column to Use As a Sort Specification

Before you can sort by specific columns, you must modify the style.vgw and style.ufl files. (For information on including a column in a sort specification, see “Using the sort_by Column to Specify a Sort Order”.) Both files are in the directory:

$SYBASE/$SYBASE_FTS/collections/db.owner.index/style

where db.owner.index is the database, the database owner, and the index created using sp_create_text_index. For example, if you created a text index called i_blurbs on the pubs2 database, the full path to those files would be similar to:

$SYBASE/$SYBASE_FTS/collections/pubs2.dbo.i_blurbs/style

To edit the style.vgw and style.ufl files, follow these steps:

  1. Drop the text index that contains the columns for which you are adding definitions. (Dropping the text index does not drop the collection directory.)

    For example, to add definitions for the copy column in the blurbs table, use the following command to drop the text index:

    sp_drop_text_index i_blurbs
    
  2. Edit the style.vgw file. Following this line:

    dda    "SybaseTextServer"
    

    add an entry for the column you are defining. The syntax is:

    table: DOCUMENTS
    {
                        copy: fcolumn_number copy_column_number
    }
    

    where column_number is the number of the column you are defining. Column numbers start with 0; if you want the first column to be sorted, specify “f0”; to sort the second column, specify “f1”; to sort the third column, specify “f2”, and so on.

    For example, to define the first column in a table, the syntax is:

    table: DOCUMENTS
    {
              copy: f0 copy_f0
    }
    

    Then, your style.vgw file will be similar to this:

    #
    #       Sybase Text Server Gateway
    #
    $control: 1
    gateway:
    {
         dda:    "SybaseTextServer"
    {
         copy: f0 copy_f0
    }
    }
    
  3. Edit the style.ufl file, by adding the column definition for a data table named fts. The syntax is:

    data-table:            fts
    {
    
             fixwidth:         copy_fcolumn_number precision datatype
    }
    

    Column numbers start with 0; if you want the first column to be sorted, specify “f0”; to sort the second column, specify “f1”; to sort the third column, specify “f2”, and so on. For example, to add a definition for the first column of a table, with a precision of 4, and a datatype of date, enter:

    data-table: fts
    {
            fixwidth:     copy_f0   4   date
    }
    

    Similarly, to add a definition for the second column of a table with a precision of 10, and a datatype of character, enter:

    data-table: fts
    {
         fixwidth:     copy_f1   10   text
    }
    
  4. Re-create the index, using sp_create_text_index.