home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / srev13g.zip / mtchfile.doc < prev    next >
Text File  |  1999-03-16  |  6KB  |  154 lines

  1. 15 March 1999
  2.  
  3.        Description of SRE-http's "find best file matches" INTERPRETable addon
  4.  
  5. The MTCHFILE facility of SRE-http is used when a request selector does
  6. not match a resource on your server.  That is, when no file can be found
  7. that matches the requested file.  It's purpose is to present the client
  8. with a list of "best matches" that she can then select.
  9.  
  10. These best matches are determined by looking at files in the directory
  11. that the "selector" points to, and using a simple pattern matching
  12. algorithim to determine what are the best matches.  Basically,
  13. the more a file name looks like the name portion of the request selector,
  14. the better a match it is.  
  15.  
  16.  
  17. Usage:
  18.  
  19.    MTCHFILE.RXX is an "INTERPRETable" addon for SRE-http -- it is designed to be
  20.    used in a
  21.        <!-- INTERPRET FILE MTCHFILE.RXX -->
  22.    "server side include" keyphrase.
  23.  
  24.   In particular, it is designed to be used in  "virtual not_found_url" files.
  25.   An example of this  MTCHFILE.SHT.
  26.  
  27.   Thus, to use MTCHFILE (assuming that D:\www is your Goserve data directory):
  28.      a) copy MTCHFILE.SHT to D:\www
  29.      b) set NOT_FOUND_URL='virtual=mtchfile.sht' (use the SRE-http 
  30.         configurator, or edit INITFILT.80). 
  31.         (for details on NOT_FOUND_URL, see INITFILT.DOC)
  32.         
  33.   That's it!  Try to hit your site with a "misspelled" URL, and see what 
  34.   happens.
  35.  
  36.   Once you are convinced that it works, you'll probably want to edit 
  37.   MTCHFILE.SHT -- say, by adding a link to your "home page".
  38.  
  39.  
  40.   
  41. Discussion:
  42.  
  43.   By default, MTCHFILE.RXX produces a list of five "links", with
  44.   each of the 5 items preceeded by a <LI>.
  45.  
  46.   For example, if your misspelled selector is /SAMPLES/GUDE.HTM, 
  47.   then MTCHFILE.RXX might generate:
  48.  
  49.     <li><a href="/samples/guide.htm">guide.htm</a> <em>(41)</em>
  50.     <li><a href="/samples/guideg.htm">guideg.htm</a> <em>(37)</em>
  51.     <li><a href="/samples/guidetoc.htm">guidetoc.htm</a> <em>(33)</em>
  52.     <li><a href="/samples/range.htm">range.htm</a> <em>(27)</em>
  53.     <li><a href="/samples/dosearch.htm">dosearch.htm</a> <em>(26)</em>
  54.  
  55.  
  56.   Note that the numbers in parenthesis are "scores", with a score of 100
  57.   representing a perfect match.
  58.  
  59.   This default setup is designed to be used with an HTML list. For example,
  60.   in your MTCHFILE.SHT, you could include:
  61.  
  62.      <p>Some possible matches:
  63.      <ol>
  64.         <!-- INTERPRET MTCHFILE.RXX -->
  65.      </ol>
  66.  
  67.   Using the above example, this would display the following (pretend the 
  68.   file names are clickable links):
  69.  
  70.     Some possible matches:
  71.  
  72.        1.guide.htm (41) 
  73.        2.guideg.htm (37) 
  74.        3.guidetoc.htm (33) 
  75.        4.range.htm (27) 
  76.        5.dosearch.htm (26) 
  77.  
  78.  
  79. Can I prevent files from being displayed?
  80.    
  81.    Yes, any file named in the DIR_EXCLUSION parameter will NOT be displayed (and
  82.    you can use * wildcard in filenames you include in the DIR_EXCLUSION list).
  83.    Furthermore, any subdirectory named in DIR_EXCLUSION will NOT be checked
  84.    (* wildcards are not supported for subdirectory names).
  85.  
  86.    Note that filenames (and subdirectories) are "relative" to a directory -- they
  87.    should NOT be specified with path information (see INITFILT.DOC, or DIR.DOC,
  88.    for a discussion of the DIR_EXCLUSION parameter).
  89.  
  90.  
  91. What if the directory does not match?
  92.  
  93.    If the selector does not match to an existing directory, MTCHFILE.RXX will
  94.    strip subdirectory names until if finds an existing directory.  The 
  95.    usual virtual directory matches are attempted; with the final case
  96.    (a / for a directory) always mapping to the GoServe data directory.
  97.  
  98.    For example (assuming the GoServe data directory is D:\WWW):
  99.      a) if the requested selector is /SAMPLES/GROP10/TEST/PRICES.HTML
  100.      b) D:\WWW\SAMPLES exists, but NOT D:\WWW\SAMPLES\GROP10
  101.   then,
  102.      MTCHFILE will look for (in order)
  103.         D:\WWW\SAMPLES\GROP10\TEST
  104.         D:\WWW\SAMPLES\GROP10
  105.         D:\WWW\SAMPLES
  106.      Since D:\WWW\SAMPLES exists, MTCHFILE will compare PRICES.HTML against
  107.      all filenames in D:\WWW\SAMPLES. 
  108.  
  109.     Note that selectors that point to virtual directories work the same way --
  110.     though the "ulimate" directory will always be the GoServe data directory. 
  111.         
  112.  
  113. Configuring MTCHFILE
  114.  
  115.   You can modify the behavior of MTCHFILE by including "arguments". 
  116.   The full syntax of MTCHFILE is:
  117.  
  118.       <!-- INTERPRET MTCHFILE.RXX  nshow, prefix, noscore, altname -->
  119.  
  120.   The 4 arguments are optional, and are:
  121.        nshow = number of "best matches" to show. The default is 5
  122.        prefix = string to place before matches. The default is <LI>
  123.        noscore = if 1, then suppress display of the score
  124.        altname = instead of matching the request selector, match altname
  125.  
  126.   Thus:
  127.  
  128.      <p>Some possible matches:
  129.      <br>
  130.         <!-- INTERPRET MTCHFILE.RXX 3, <BR> --*  ,1 -->
  131.      <br>
  132.   might return:
  133.  
  134.        Some possible matches:
  135.        -- * guide.htm 
  136.        -- * guideg.htm  
  137.        -- * guidetoc.htm 
  138.    
  139.    
  140.   The "altname" argument is somewhat odd -- if you use it, MTCHFILE.RXX is
  141.   not dynamic.  However, there is a trick you can use: use an ALTNAME of 
  142.   ?n, where is a number that points to the "nth" option following the
  143.   ? in the selector (where options are seperated by & characters).
  144.  
  145.   Thus, 
  146.     a) if the selector is /test/trymtch?samples/forh.doc
  147.     b) if /test/trymtch.sht contains
  148.          
  149.       <!-- INTERPRET MTCHFILE.RXX  5, <li>, 0 , ?1 -->
  150.      
  151.    Then MTCHFILE.RXX will find the best matches to samples/forh.doc
  152.  
  153.  
  154.