Advanced Features


CGI-Handler Instructions

Definition

CGI-Handler is used to index data items in database or bulletin boards. For DB indexing, there needs to be a program that acts like a bridge that connects DeepSearch and DB. This program displays DB data items in the form of a document on web browsers so that DeepSearch could index them.

 

CGI-Handler ±¸¼ºµµ

 

Bridge Program(Update CGI)

The program does not retrieve all the data in DB but only the key values of data table to be indexed and displays those record information as arguments to View CGI.

View CGI

Receives arguments from the Bridge Program and display records in DB as documents to index.

Making the Bridge Program

Use the following arguments to assign which type of action to perform. You could make the program in the form of CGI program or execution program.

    i.e.) CGI Program : Update cgi? Argument
          Execution Program: ExecutionFileName Argument FileName

  • do=full/increment/confirm
  • - full indexing: do=full -> index all data items
    - incremental indexing: do=increment -> index added/modified/deleted items
    - confirm indexing: do=confirm -> confirm that indexing job has finished

    i.e.) view.cgi?do=full
          view.exe do=full xxx.dat (file name to save)

  • err=encoded URL
  • Use this argument to recover from "indexing" status to "ready to index" status in case of server or runtime errors.

    i.e.) view.cgi?err= http://www.namo.co.kr/cgi-bin/view.cgi?ID=100
           view.exe  err= http://www.namo.co.kr/cgi-bin/view.cgi?ID=100

  • Output Form: (+/-/=) +URL of a page to index +Ascii(1) +date +<br>\n

    Make sure to display retrieved data as a normal text format with "<br>\n" at the end of each line so that it could be confirmed with web browsers as well (for CGI Program). For an execution program, do the same but save it to a designated file.
    - +: added data, -: deleted data, =: modified data
    - Ascii (1): Ascii code value 1() to differentiate URL and Date
    - Date: in the form of YYYYMMDDHHMMSS
    i.e.- +http://172.16.100.111/board_content.asp?gbn=SB&no=3120000713000000<br>\n

    i.e.) -http://www.namo.co.kr/cgi-bin/view.cgi?ID=10120030710000000<br>\n
           +http://172.16.100.111/board_content.asp?gbn=SB&no=3120000713000000<br>\n

  • DeepSearch DB Table

    Add the following two fields in DeepSearch database (DB that retrieves data) to inform indexing status.

    Field Names

    D_STS char(1), Status Value: +(add), =(modify), -(delete)
    R_STS char(1), Status Value: 0(ready), 1(indexing), 2(indexed)

    Data

    Adding:  D_STS (+) , R_STS (0)
    Modifying:  D_STS (=) , R_STS (0)
    Deleting:  D_STS (-) , R_STS (0)

Setting on the Admin Page

- Go to Indexing/URL
- Type in the CGI Bridge program name inside of Specify CGI-Handler box:
i.e.- http://deepsearch.namo.com/~essence/cgi_update.php
- Add in Indexing URLs as well. In case of DB indexing only, add the URL and check Do not index[4].
i.e.-http://deepsearch.namo.com (check Do not index[4])
- Perform indexing.

Example of CGI-Handler Program

update.php 

<?php

include ("$DOCUMENT_ROOT/connect.inc");
if($do == "full")
{
$que1 = "select * from data_inf ";
$result1 = mysql_query($que1,$connect);
$tot_count = mysql_num_rows($result1);

$row = mysql_fetch_array($result1);
while($row)
{
if($row[d_sts]=="-"){ //for deleting
$que2 = "update data_inf set r_sts='2' where no= '$row[no]' ";
$result2 = mysql_query($que2,$connect);

$row = mysql_fetch_array($result1);

}
else{
$str = "+" . "http://xo.namo.co.kr/~essence/xo/xo_view.php?id=" . $row[no] . chr(1) . $row[tdate] . "000000<BR>" . chr(10);
printf("%s",$str);

$que2 = "update data_inf set r_sts='1',d_sts='+' where no= '$row[no]' ";
$result2 = mysql_query($que2,$connect);

$row = mysql_fetch_array($result1);
}
}
}
else if($do == "increment")
{
$que1 = "select * from data_inf where r_sts <> '2'";
$result1 = mysql_query($que1,$connect);
$tot_count = mysql_num_rows($result1);


$row = mysql_fetch_array($result1);
while($row)
{
$str = $row[d_sts] . "http://xo.namo.co.kr/~essence/xo/xo_view.php?id=" . $row[no] . chr(1) . $row[tdate] . "000000<BR>" . chr(10);
printf("%s",$str);

$que2 = "update data_inf set r_sts='1' where no= '$row[no]' ";
$result2 = mysql_query($que2,$connect);

$row = mysql_fetch_array($result1);
}
}
else if($do == "confirm")
{
$que1 = "update data_inf set r_sts='2' where r_sts = '1' ";
$result1 = mysql_query($que1,$connect);
}

mysql_close($connect);


?>

 

 

black03_up.gif