|
SYNOPSIS
<profiler INIT $table [$profile [$field]]>
<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 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
profiler returns nothing (INIT), or the intersection
of the words in $msg with those in the index (GET).
EXAMPLE
... create table ProfileTable with queries and index ...
<profiler INIT ProfileTable test Query> <!-- init profiler -->
... get new message $msg ...
<profiler GET $msg test> <!-- trim the $msg -->
<SQL "select Name from ProfileTable where Query likein $ret">
$Name matches the message
</SQL>
CAVEATS The profiler function was added in version 2.6.938540000 19990928.
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.
SEE ALSO
xtree, wordlist
Copyright © Thunderstone Software Last updated: Mon Feb 18 10:28:15 EST 2013
|