Building the PSP Web Application

This section describes how to build the PSP Web application.

The following steps describe the process for creating the PSP Web application:

  1. Create Your Text Tables

    You must create text tables with the CREATE TABLE command to store your HTML files. These examples create the tables output_table, gist_table, and theme_table as follows:

    CREATE TABLE output_table  (query_id NUMBER, document CLOB);
    CREATE TABLE gist_table  (query_id NUMBER, pov VARCHAR2(80), gist CLOB);
    CREATE TABLE theme_table  (query_id NUMBER, theme VARCHAR2(2000), weight NUMBER);
    
  2. Load HTML Documents into Table Using SQL*Loader

    You must load the text tables with the HTML files. This example uses the control file loader.ctl to load the files named in loader.dat. The SQL*Loader statement is as follows:

    % sqlldr userid=scott/tiger control=loader.ctl 
    
  3. Create the CONTEXT Index

    Index the HTML files by creating a CONTEXT index on the text column as shown here. Because you are indexing HTML, this example uses the NULL_FILTER preference type for no filtering and uses the HTML_SECTION_GROUP type as follows:

    create index idx_search_table on search_table(text)
      indextype is ctxsys.context parameters
      ('filter ctxsys.null_filter section group CTXSYS.HTML_SECTION_GROUP');
    
  4. Compile the search_htmlservices Package in Oracle Database

    The application must present selected documents to the user. To do so, Oracle Database must read the documents from the CLOB in search_table and output the result for viewing, This is done by calling procedures in the search_htmlservices package. The file search_htmlservices.sql must be compiled. You can do this at the SQL*Plus prompt as follows:

    SQL> @search_htmlservices.sql
    
    Package created.
    
  5. Compile the search_html PSP Page with loadpsp

    The search page is invoked by calling search_html.psp from a browser. You compile search_html in Oracle Database with the loadpsp command-line program as follows:

    % loadpsp -replace -user scott/tiger search_html.psp
    

    The output will appear as:

    "search_html.psp": procedure "search_html" created.
    

    See Also:

    Oracle Database Development Guide for more information about using PSP

  6. Configure Your Web Server

    You must configure your Web server to accept client PSP requests as a URL. Your Web server forwards these requests to Oracle Database and returns server output to the browser. See Figure A-3.

    You can use the Oracle WebDB Web listener or Oracle Application Server, which includes the Apache Web server. See Oracle Database 2 Day + PHP Developer's Guide for information about installing Apache HTTP Server.

  7. Enter the Query from a Browser

    You can access the query application from a browser using a URL. You configure the URL with your Web server. An example URL might look like:

    http://server.example.com:7777/mypath/search_html
    

    The application displays a query entry box in your browser and returns the query results as a list of HTML links, as shown in Figure A-1 and Figure A-2.