Configuring htdig to produce xml

htdig uses a few configuration files. An example configuration is included in this package, It can be found in config/htdig/config. The first interesting file is called htdig.conf , in this file you can configure the url of your site and the location of the search database files. The second interesting file has to do with making htdig output xml. edit xml.conf and point template_dir to config/htdig/config/templates using a full path name.

Indexing your website

./rundig can be used to index you database this script is provided by htdig but also present in this package, you need to start in with the right configuration (./rundig -c htdig.conf). On a clean mmbase 1.7 install this takes a few minutes (you didn't forget to start your website first did you?).

Testing if the indexing worked

htsearch -c xml.conf keywords=mmapps now should return something like this

Content-type: text/html

<?xml version="1.0"?>
<htdig>
     <result>
     <title>XML Importer installation guide</title>
     <url>http://localhost:8080/mmdocs/developers/xmlimporter/quickstart.html</url>
     <score>6.909753</score>
     <percent>100</percent>
     <excerpt>&lt;strong&gt;&lt;code&gt;... &lt;/code&gt;&lt;/strong&gt; the XML-importer homepage on the MMBase website. * Update the contents of mmbase/applications/xmlimporter from cvs. * Update the contents of html/&lt;strong&gt;mmapps&lt;/strong&gt;/xmlimporter from cvs. * Update the file config/default/dtd/transactions.dtd from cvs. * Edit transactionhandler.xml in your MMBase modules config directory&lt;strong&gt;&lt;code&gt; ...&lt;/code&gt;&lt;/strong&gt;</excerpt>
     <size>10083</size>
     <sizek>10</sizek>
     <description>quickstart.html</description>
     <descriptions>quickstart.html&lt;br&gt;
</descriptions>
     <current>1</current>
     <modified>2004-09-24</modified>
     <hopcount>4</hopcount>
     <docid>280</docid>
     <anchor></anchor>
     <backlinks>2</backlinks>
   </result>

  <search>
    <words>mmapps</words>
    <logical_words>mmapps</logical_words>
    <match_method>and</match_method>
    <sort>score</sort>
    <keywords></keywords>
    <matches>1</matches>
    <firstdisplayed>1</firstdisplayed>
    <lastdisplayed>1</lastdisplayed>
    <matches_per_page>10</matches_per_page>
    <page>1</page>
    <cgi></cgi>
    <config></config>
    <exclude></exclude>
    <resitrct></resitrct>
    <version>3.2.0b4-072201</version>
		<pagelist><page></page></pagelist>
  </search>
</htdig> 

Configuring htdig bean

The HTDigBean is configured the statnard way mmbase utils are configured in config/utils/htdigbean.xml. to test if it works copy htdigsearch.jar to our WEB-INF/lib dir, copy search.jsp to the root of you webserver, copy the config/utils to your mmbase config utiles directory and try it.