Sybase Technical Library - Product Manuals Home
[Search Forms] [Previous Section with Hits] [Next Section with Hits] [Clear Search] Expand Search

Creating a Custom Thesaurus
(Enhanced Version Only) [Table of Contents] Chapter 5 Writing Full-Text Search
Queries

Full-Text Specialty Data Store User's Guide

[-] Chapter 4 Setting Up Verity Functions
[-] Creating Topics (Enhanced Version Only)

Creating Topics (Enhanced Version Only)

The section provides a condensed overview of Verity Topics. Topics are discussed in detail in Chapter 8, "Verity Topics."

A TOPICŪ is a grouping of information related to a concept or subject area. With topic definitions in place, a user can perform searches on the topic instead of having to write queries with complex syntax.

The user creates topics which can be combinations of words and phrases, Verity operators and modifiers, and weight values. Then, any user can query the topic.

Before you create topics, determine your application requirements, and establish standards for naming conventions and for the location of the following:

To implement topics, perform the following steps:

  1. Create one or more outline input files to define your topics (see "Creating an Outline File"). Each outline file is used to populate one topic set.

  2. Create and populate a topic set directory, using the mktopics utility (see "Creating a Topic Set Directory"). Each topic set directory is populated based on one topic outline input file.

  3. Create a knowledge base map, specifying the locations of one or more topic set directories (see "Creating a Knowledge Base Map")

  4. Set the knowledge_base configuration parameter to point to the location of the knowledge base map (see "Defining the Location of the Knowledge Base Map")

  5. Execute queries against defined topics.

The following sample files illustrate the topics feature:

These files are in the $SYBASE/$SYBASE_FTS/sample/scripts directory.

Creating an Outline File

A topic outline file specifies all the combinations of words and phrases, Verity operators and modifiers, and weight values that the search engine uses when you issue a query using the topic. The outline file is an ASCII text file in a structured format.

For example, the following outline file defines the topic "saint-bernard":

$control: 1 
saint-bernard <accrue> 
*0.80 "Saint Bernard" 
*0.80 "St. Bernard" 
* "working dogs" 
* "large dogs" 
* "European breeds" 
$$ 

When you issue a query specifying the topic "saint-bernard", the Full-Text Search engine:

This example is a very basic topic definition. An outline can introduce more complex relationships by using:

Creating a Topic Set Directory

Use the mktopics utility to create and populate a topic set directory. It is located in:

$SYBASE/$SYBASE_FTS/verity/bin

Run, or define an alias to run, mktopics from this bin directory. You can create a topic set directory or directories in any work directory.

The mktopics syntax is:

mktopics -outline outline_file.otl -topicset topic_set_directory

where:

For example, to execute the mktopics utility reading the saint-bernard.otl file defined above, and directing output to a work directory, use the syntax:

mktopics -outline /usr/u/sybase/topic_outlines/saint-bernard.otl -topicset /usr/u/sybase/topic_sets/saint-bernard_topic

Creating a Knowledge Base Map

A knowledge base map specifies the locations of one or more topic set directories. Create an ASCII knowledge base map file that defines the fully-qualified directory paths to your topic sets.

For example, the following knowledge base map file illustrates how you can list multiple knowledge bases in the map. The first entry identifies the topic set directory created with mktopics above.

$control:1 
kbases:
{ 
kb: 
/kb-path = /usr/u/sybase/topic_sets/saint-bernard_topic 
kb: 
/kb-path = /usr/u/sybase/topic_sets/another_topic
}

Defining the Location of the Knowledge Base Map

Set the knowledge_base configuration parameter to point to the location of the knowledge base map. For example:

sp_text_configure KRAZYKAT, 'knowledge_base', '/usr/u/sybase/topic_sets/sample_text_topics.kbm'

The knowledge_base configuration parameter is static, and you must restart the Full-Text Search engine for the definition to take effect.

Executing Queries Against Defined Topics

You can now execute queries using the defined topic instead of a complex query. For example, before you create the "saint-bernard" topic, you would have to use the following syntax:

...where i.index_any = "<accrue> ([80]Saint Bernard, [80]St. Bernard, working dogs, large dogs, European breeds)"

to find documents that:

After you create the topic "saint-bernard", you can use this syntax:

...where i.index_any = "<topic>saint-bernard"

or:

...where i.index_any = "saint bernard"

If you enter a word in a query expression, the Full-Text Search engine tries to match it with a topic name. If you enter a phrase in a query expression, the Full-Text Search engine replaces spaces with hyphens (-), and then tries to match it with a topic name. For example, the Full-Text Search engine matches "saint bernard" with the topic "saint-bernard".

See the sample_text_topics.sql file for examples of using topics in queries.

Troubleshooting Topics

If the knowledge_base configuration parameter specifies a knowledge base map file that does not exist, the Full-Text Search engine will not be able to start a session with Verity, and the server will not start. If the map file exists but contains invalid entries, Verity issues warning messages at start-up time. You can correct errors by editing the <textserver>.cfg file in the $SYBASE directory. You can correct path information and change the line beginning: "knowledge_base=".


Creating a Custom Thesaurus
(Enhanced Version Only) [Table of Contents] Chapter 5 Writing Full-Text Search
Queries