Profiling issue

rajesh11
Posts: 52
Joined: Fri Dec 16, 2005 7:41 am

Profiling issue

Post by rajesh11 »

Hi There,

<A NAME=main>
<db=/usr/local/morph3/texis/public/db1>
<profiler INIT html test Title>
<$msg="Helsinki">
<profiler GET $msg test>
<apicp allinear 1>
<SQL skip=0 max=50 "select Title from html where Title likein $ret">
$Title matches the message<br><Br>
</SQL>
</A>

I have created this code for Profiling but I don't that it is serving my purpose. Actually I want to send "News Alerts" to people, everytime a NEW news in added to the table. The code above simply retreives those records from the table where "Title" matches "Helsinki" (which is a keyword given by a User for News Alert). But this can be done in the normal way also, without using Profiling. So, please give me a good example of Profiling so that I can implement it in my script. Also, please explain, if we have to create a NEW table for Profiling or can we use "html" table? What is the use of $msg variable? Will it automically send e-mails to users or do we have to run a cron?
User avatar
John
Site Admin
Posts: 2622
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Profiling issue

Post by John »

The profiler does not automatically send emails or do anything with the match, you need to decide what to do with the match.

You should create the metamorph counter index on the table containing the users queries, and $msg would contain the new story, which you then query the table of queries, not html.

http://www.thunderstone.com/texis/site/ ... iling.html and following pages should be helpful.
John Turnbull
Thunderstone Software
rajesh11
Posts: 52
Joined: Fri Dec 16, 2005 7:41 am

Profiling issue

Post by rajesh11 »

Still my problem is not resolved. Please give me some "COMPLETE example code", on the basis of which I can carry on with the further development.

I have seen this example:

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

But its not complete, so I am still unable to implement "Profiling". This code says:

1) "create table proftbl with queries and index" -- Does that mean, we have to store our queries in a separate Profile table?

2)"get new message $msg" -- What is this message and from where will it come?

3) <profiler GET $msg test> -- What will this statement return?
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

Profiling issue

Post by mark »

See the example code in the tutorial mentioned above. It's on page http://www.thunderstone.com/texis/site/ ... touse.html

1) Yes, the queries are stored in a table of your creating.
2) "get new message" is you getting the data that you want profiled. It's entirely dependant on your app. It could be from a fetch, user input, a table, a file, ...
3) profiler GET returns a query to be used in a SQL LIKEIN as in the examples and described in the docs.
User avatar
John
Site Admin
Posts: 2622
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Profiling issue

Post by John »

1. Yes, you have to store the queries in a separate Profile table.

2. The new message is the new document that in your case is the new news story.

3. <profiler GET $msg test> returns the query used to search for matching queries.

That example and the one in the Tutorial are complete apart from the application specific portions, such as the user interface for managing alerts, getting the new document that is being profiled, and doing what you want with the results.
John Turnbull
Thunderstone Software
rajesh11
Posts: 52
Joined: Fri Dec 16, 2005 7:41 am

Profiling issue

Post by rajesh11 »

I am writing this srcipt in "dowalk" -- "storepage" routine before inserting data into "Html" table ---

<SQL NOVARS "create metamorph counter index profQury on proftbl(Query)"></SQL>

<profiler INIT proftbl test Query>
<profiler GET $newPage test>
<$tmpret=$ret>

<strfmt %s $page><$newPage=$ret>

<WRITE append /usr/local/morph3/texis/scripts/webinator/log2.txt>
<fmt "%t abc %s \n" "now" $tmpret>
</WRITE>

<if $tmpret neq ''>
<SQL "SELECT Name FROM proftbl WHERE Query LIKEIN $tmpret">
<processresult>
</SQL>


</if>

But the <profiler GET> statement is not returning anything. Kindly help me out. Also, do I have to everytime create a new "Metaporph Counter Index", when a new record is inserted in proftbl?

My "proftbl" has following data:
Name Query
------------+------------+
xicom1 palkkoihin
xicom2 Espoon
xicom3 Uutuuksia syksyn
xicom4 Keskustelut
xicom5 Unicef
xicom1 palkkoihin
xicom2 Espoon
xicom3 Uutuuksia syksyn
User avatar
John
Site Admin
Posts: 2622
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Profiling issue

Post by John »

You should update the index by issuing the create index statement after updating proftbl.

Did any of the $newPage contain the Query words?
John Turnbull
Thunderstone Software
rajesh11
Posts: 52
Joined: Fri Dec 16, 2005 7:41 am

Profiling issue

Post by rajesh11 »

Yes almost every $newPage contained some or the other query word like "Espoon" but still <profiler GET> statement is not returning anything.
User avatar
John
Site Admin
Posts: 2622
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Profiling issue

Post by John »

Here's a small script demonstrating the output of the profiler:

<SCRIPT LANGUAGE=vortex>

<A NAME=testit public>
<profiler INIT profiles test query>
<$body = "some piece of text" >
------ body: [$body]
<profiler GET $body test>
query words: [$ret]
</A>

<A NAME=main>
Start
<SQL "drop table profiles"></SQL>
<SQL NOVARS "create table profiles(id counter, name varchar(40), query varchar(40))"></SQL>
<SQL NOVARS "insert into profiles values(counter, 'test', 'piece')"></SQL>
<SQL NOVARS "create metamorph counter index xtest_idx on profiles(query)"></SQL>
<testit>
End
</A>

</SCRIPT>
John Turnbull
Thunderstone Software
rajesh11
Posts: 52
Joined: Fri Dec 16, 2005 7:41 am

Profiling issue

Post by rajesh11 »

The code runs fine when implemented in a separate script but <profiler GET> statement does not return anything when it is implemented in "dowalk" script. We are unable to understand the reason behind it. Please advise.
Post Reply