IBM Support

A Simple Example Illustrating the BTS Token Analyzer

Question & Answer


Question

You are working with the basic text search (BTS) datablade and you want an example illustrating use of the token analyzer.

Answer

Use the following steps:

  1. Create the table, insert rows, create the bts index, and execute update statistics.

    create table tab1
    (
    col1 int,
    col2 lvarchar
    );

    insert into tab1 values (1, 'merry');
    insert into tab1 values (2, 'merry month in may');
    insert into tab1 values (3, 'month');

    create index bts_idx2 on tab1 (col2 bts_lvarchar_ops) using bts (analyzer="keyword") in sbspace1;

    update statistics high;


  2. Execute queries.

    select * from tab1 where bts_contains(col2, 'merry');

    col1 1
    col2 merry

    1 row(s) retrieved.


    select * from tab1 where bts_contains(col2, 'month');

    col1 3
    col2 month

    1 row(s) retrieved.


    select * from tab1 where bts_contains(col2, 'merry month in may');

    col1 1
    col2 merry

    col1 3
    col2 month

    2 row(s) retrieved.


    select * from tab1 where bts_contains(col2, '"merry month in may"');

    col1 2
    col2 merry month in may

    1 row(s) retrieved.

Related Information

[{"Product":{"code":"SSAVH9","label":"Informix Spatial DataBlade"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Not Applicable","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF022","label":"OS X"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"3.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
06 April 2023

UID

swg21579364