profiler - assist in searching query profiles

SYNOPSIS

<profiler INIT $table [$profile [$field [$db]]]>
<profiler GET $msg [$profile]>


DESCRIPTION
The profiler function is helpful in managing a large number of relatively fixed queries against changing data, for example users' search profiles to match against incoming news data. When a news message arrives, it is desired to find out which of many users' queries, kept in a table, match the new message. A Metamorph counter index and a LIKEIN query are used for this purpose. However, profiler can first be used to optimize the query string given to LIKEIN, speeding the search. (For more details on Metamorph counter indexes and the LIKEIN operator, see the Texis manual.)

A profile is first initialized with the INIT command, giving it the name of the SQL $table (in database $db - current database if empty/unspecified) with the queries, and an optional $profile name (to distinguish it if multiple profiles are used). The optional $field argument is the field in the table that holds the query for each profile; if it is unspecified or empty the first Metamorph index found on the table will be used to determine the field. INIT loads the words from the index into memory for later use.

When a new message is to be searched against, the GET command is used to intersect its words with those of all the queries. The result is a list of only those words that occur in both the message and at least one query, to be passed to LIKEIN. This is generally smaller than the original message, and thus faster to search.

When the table of queries is modified, profiler will update its internal copy of the index of words, after the Metamorph index is updated, the next time GET is called.


DIAGNOSTICS
The profiler INIT command returns "Ok" on success, otherwise a human-readable error message. The profiler GET command returns the intersection of the words in $msg with those in the index.


EXAMPLE

... create table SearchTable with queries and index ...
  <profiler INIT SearchTable testProfile QueryField>
  ... get new message $msg ...
  <profiler GET $msg testProfile>        <!-- trim the $msg -->
  <SQL "select Name from SearchTable where QueryField likein $ret">
     $Name matches the message
  </SQL>


CAVEATS
The profiler function was added in version 2.6.938540000 19990928.

The $db option was added in version 7.05.1459800000 20160404.

See the Texis manual for details on Metamorph counter indexes and LIKEIN searches.

The Metamorph indexes on the query table must be updated for profiler to take note and update its memory copy.

Prior to version 7.06.1487025000 20170213, the INIT command always returned empty, regardless of success or failure.


SEE ALSO
xtree, wordlist


Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.