Searching with ht://dig
Home ] Up ]
 

 

  1. Create the directory where the specific database will be held:

    mkdir /usr/local/share/htdig/database/your_website_com
     
  2. Change to the htdig conf directory:

    cd /usr/local/etc/htdig/
     
  3. Copy the default conf file to the custom conf file that you want to use:

    cp htdig.conf.sample htdig_your_website_com.conf
     
  4. Edit htdig_your_website_com.conf to change these variables:

    database_dir: /usr/local/share/htdig/database/your_website_com
    start_url: http://your.website.com/
    maintainer: your.address@email.com

     
  5. Use the rundig script to create the database:

    rundig -c /usr/local/etc/htdig/htdig_your_website_com.conf -s -v
     
  6. Check /usr/local/share/htdig/database/your_website_com to make sure that the db files were created in there.
     
  7. Copy 'htsearch' to common cgi-bin directory:

    cd /usr/local/share/apache/cgi-bin
    cp htsearch /usr/local/www/cgi-bin/

     
  8. Run 'htsearch' from the command line to verify that the db is working:

    cd /usr/local/www/cgi-bin
    ./htsearch -c /usr/local/etc/htdig/htdig_your_website_com.conf
    Enter value for words: icmpv6
    Content-type: text/html

    Enter value for format: text


    Once you press enter, you should see HTML scrolling on the screen. This is a good thing!
     
  9. Create symbolic link in the htdocs directory for htdig icons:

    cd /<whatever>/htdocs
    ln -s /usr/local/share/apache/icons/htdig htdig

     
  10. Copy the search.html file to the htdocs directory

    cp /usr/local/share/apache/htdocs/search.html /<whatever>/htdocs/search.htm
     
  11. Now, go to the htdocs directory and modify the search page to use the correct conf file:

    <input type="hidden" name="config" value="htdig_your_website_com">
     
  12. Now go test it! it is working great! now, on to making the search/results page look like the other pages.
     
  13. Edit the conf file again to specify that you want to use custom pages (header, footer, etc.):

    search_results_header: /<whatever>/htdocs/htdig_templates/htdig_header.htm
    search_results_footer: /<whatever>/htdocs/htdig_templates/htdig_footer.htm
    template_map:  Long long builtin-long \
                   Short short builtin-short \
                   Default default /<whatever>/htdocs/htdig_templates/htdig_result.htm
    template_name: Default

     
  14. Of course, you also need to create those files in your htdocs directory.  On my site, I use Front Page with a theme.  This is a pain in the ass because Front Page wants to rewrite my htdig_header.htm all of the time.  This is a problem, because the results are served from http://michael.gargantuan.com/cgi-bin/htsearch, and the htdig_header.htm page has images links in it (generated by Front Page) that use syntax like <img src="_themes/bl....">.  Of course, there is no "_themes" directory under /cgi-bin/.  So, I created a directory called 'htdig_templates' and that is where I keep the search results templates.  This works out nicely because Front Page will create all of the links to the theme files with a leading "../", which is what is required to find those files from the /cgi-bin/ directory.
     
  15. That's it!
 

 

 

My name is Michael Oliver, and I can be contacted by email here.
The current time is Sunday, 21-Jan-2018 04:38:58 UTC.
This page was last modified on Friday, 11-Mar-2011 21:01:57 UTC.
This page has received 707 hits since April 3, 2002.