Thunderstone Software Document Search, Retrieval, and Management
Search:
Texis Tutorial
 

9.4 Patent Search

In the following sections we'll explore how Vortex integrates the Texis RDBS with the Web by examining the following sample application.

Copy this script to the file texis/scripts/example in your installation directory so you can run it in your browser and follow along.

This application presents a simple two-tier SQL search interface to the patent table that is part of the standard Texis distribution (in the /usr/local/morph3/texis/testdb database). Along the way we'll see how it demonstrates:

  • Getting vars to and from <FORM> s
  • Coding style: top/bottom HTML functions <look> and </look>
  • Re-entering script at different functions via $url
  • Two-tier SQL search - results page plus details page
  • Modifying SQL queries with $null
  • Formatting output with <fmt>
  • State retention across invocations
  • Paginating results
  • Hit markup with <fmt %mbH>

(Run this example.    Download the source.)


  <SCRIPT LANGUAGE=vortex>
     
  <EXPORT $id $skip    URL>
  <EXPORT $query $when URL USEROK>
  
  <!------------------------------------------------------------------>
  <A NAME=look PRIVATE title>   <!-- Header HTML -->
    <HTML><HEAD><TITLE>$title</TITLE></HEAD>
    <BODY BGCOLOR="white"><H2 ALIGN=center>$title</H2><P>
  </A>
  
  <!------------------------------------------------------------------>
  <A NAME=/look PRIVATE>        <!-- Footer HTML -->
    </BODY></HTML>
  </A>
  
  <!------------------------------------------------------------------>
  <A NAME=showform PRIVATE>     <!-- Show the search form -->
    <FORM METHOD=post ACTION="$urlroot/search.html">
      Search for text: <INPUT SIZE=30 NAME=query VALUE="$query"> <BR>
      With date after: <INPUT SIZE=30 NAME=when VALUE="$when"> <BR>
      <INPUT TYPE=submit>
    </FORM> <P>
  </A>
  
  <!------------------------------------------------------------------>
  <A NAME=search PUBLIC>        <!-- Do the search -->
    <look title="Patent Search Results">
    <showform>
    <$null = "">                <!-- Ignore empty user vars -->
    <SQL ROW SKIP=$skip MAX=10
        "select pcountry, pnumber, pdate, id
         from patent
         where pabstract like $query and pdate >= $when
         order by pdate asc">
      $next) <A HREF="$url/details.html">$pcountry $pnumber</A>
             <fmt " %at " "%b %e %Y" $pdate> <P>
    </SQL>
    <$id = >                    <!-- Save URL space -->
    <pagelinks>                 <!-- Generate the pagination links -->
    </look>
  </A>
  
  <!------------------------------------------------------------------>
  <A NAME=details PUBLIC>       <!-- Show a single patent in detail -->
    <look title="Patent Details">
    <showform>
    <SQL "select pdate, pcountry, pnumber, pabstract from patent
          where id = $id">
      <B>$pcountry $pnumber</B> - <fmt " %at " "%b %e %Y" $pdate> <P>
      <fmt "%mbH" $query $pabstract>
    </SQL>
    </look>
  </A>
  
  <!------------------------------------------------------------------>
  <A NAME=main PUBLIC>          <!-- Default entry point -->
    <look title="Patent Search">
    <showform>
    </look>
  </A>
  
  </SCRIPT>

Before running this example, make sure the patent table has an index (the install script probably took care of this):


  tsql -d /usr/local/morph3/texis/testdb
     "create metamorph inverted index xpabs on patent(pabstract,pdate)"

Our script has familiar <look> and </look> functions for header and footer HTML. In <showform> we display a search form that asks for text to search for, and a date to limit the patent search after. This form submits to our <search> function, which is the crux of the application.

Let's enter the text query solar cells , and the date June 1982 : search for patents on solar cells after June 1, 1982 (next page):
Back: Generating HTML Forms Next: Patent Search - Continued

 
Home   ::   Products   ::   Solutions   ::   How to Buy   ::   Support   ::   Contact Us   ::   News   ::   About
Copyright © 2013 Thunderstone Software LLC. All rights reserved.