Guide - SQL Server Text Indexes

Product Version

7.10

Product To Version


Status

final

1 Introduction

This guide describes how to add Text Indexes using Microsoft SQL Server. For information on how to handle Text Indexes on Oracle DB, see Cookbook - Oracle Text Index.

The configuration of table columns for Text Indexes using SQL Server differs to Oracle.

2 DBInit

In the cartridge dbinit.properties file where the database table is created add the following preparer:

dbinit.properties
post.ClassXX = com.intershop.beehive.core.dbinit.preparer.database.TextIndexPreparer

3 Default Index Columns Configuration

It is required to specify the table columns which are desired to be included in the Text Index. Add this configuration to the cartridge-specific properties file:

<<cartridge>>.properties
################################################################################
# text index configuration
################################################################################
intershop.cartridges.text_index.<<table_name>>=<<LIST,OF,COLUMNS>>

The property key consists of the prefix intershop.cartridges.text_index. and the table name (in uppercase letters). The value of this key is the list of included columns. Multiple column names can be delimited by a comma.

Note

For every table only a single Text index can be created. So all required index columns need to be added into one index.

4 Custom Index Columns Configuration

To provide a custom index configuration, create a Java class implementing the interface com.intershop.beehive.core.capi.jdbc.TextIndexColumnsProvider:

Interface TextIndexColumnsProvider
package com.intershop.beehive.core.capi.jdbc;

import java.sql.SQLException;
import java.util.Collection;

/**
 * Classes implementing this interface return a collection of Strings 
 * representing the columns to be included in the text index
 */
public interface TextIndexColumnsProvider
{

    public static final String NAME_SUFFIX = "_TextIndexColumnsProvider";
    public static final String GENERAL_PROVIDER = "GeneralTextIndexColumnsProvider";
    
	/**
     * defines columns included in Text Index for given table 
     * @param tableName the name of the table
     * @return Collection of columns
     * @throws SQLException
     */
    Collection<String> getColumns(String tableName) throws SQLException;
    
}

The method getColumns(String tableName) will return the list of column names included in the Text Index. For an example see class com.intershop.beehive.core.internal.jdbc.XMLAttributesTextIndexColumnsProvider which provides the column names for XMLExtensibleObjectPO.

Bind this class to the TextIndexColumnsProvider using Guice:

ObjectGraph Naming Module
bind(TextIndexColumnsProvider.class).annotatedWith(Names.named(<<table_name>> + TextIndexColumnsProvider.NAME_SUFFIX)).to(<<your_provider_class_name>>.class).in(Singleton.class);

Ensure that this binding is annotated with your table name so that the class will be found later by the preparer.

Disclaimer

The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.

Customer Support
Knowledge Base
Product Resources
Support Tickets