SourceForge.net Logo

DocSearcher is a search tool.


Overview

Download

Creating Indexes

Developer Info

Search Techniques

Support

Servlet

History

Changelog

ToDo

Creating searchable CDROM

Servlet Information

The purpose of the servlet is to provide a web interface to multiple Lucene indexes that were created by a DocSearcher client (swing) application - and do so in a fashion that would work on most any Java Application server. 

Here's an online example - in case you want to see it running before you go to the trouble of installing it:

    http://www.uscglegal.us:8080/docsearch/search

Servlet DsResults in action - click to enlarge

Tomcat and Jetty deployment


Setting up a web or intranet based search engine for DocSearcher is a six-step process:

  1. download the DocSearcher application from the downloads page
  2. import or create your DocSearcher indexes
    * Make sure the indexes are specifically created as "web server" indexes...
    When you create the index:
      -->click the advanced properties tab
            --> click on the "web server" radio button next to the text "type of index"

  3. download docsearch.war from the downloads page

  4. deploy the docsearch.war file on your application server

  5. edit your ../webapps/docsearch/WEB-INF/web.xml file to specify the proper USER_HOME value for your DocSearcher deployment.

    The value for this should the the folder where the file index_list.htm is located.  index_list.htm stores the list of DocSearcher indexes you have created with the DocSearcher client software.

    Here's an example web.xml file :
    <?xml version="1.0" ?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Webb Application 2.3//EN"
     "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <servlet>
    <servlet-name>DsResults</servlet-name>
    <servlet-class>DsResults</servlet-class>
        <init-param>
            <param-name>USER_HOME</param-name>
            <param-value>D:\docSearch</param-value>
             <!-- This is where the index_list.htm file is found.  -->
        </init-param>
        <init-param>
            <param-name>LOG_DIR</param-name>
            <param-value>D:\Logs</param-value>
        </init-param>
    </servlet>
        <servlet-mapping>
          <servlet-name>DsResults</servlet-name>
          <url-pattern>/search</url-pattern>
        </servlet-mapping>
    </web-app>



  6. restart the DocSearcher web application so that it can find your indexes

    You can visit the servlet from:

                  http://www.yourserver.com/docsearch/search


Recompiling the servlet (DsResults)

Important source files in the docsearch.war file are the following:

  • DsResults.java - this is the main servlet class that builds both the search form and its results.
  • TableA.java - a utility class that DsResults uses to read the DocSearcher configutation files so that it knows where the Lucene indexes are located
  • OrderReader.java - another utility class used by TableA for IO

To re-compile the servlet, ensure that the lucene.jar (lucene-1.3-rc1 is what I used) file is one your classpath. Other than the lucene jar file - compile like you would any servlet (i.e. javac DsResults.java), but ensure the above 3 source files are in the same directory.

If you've successfully compiled DsResults but it doesn't seem to work - check your Application Server's configuration file (on Jetty that would be /etc/jetty.xml for example) to ensure the application server knows about the servlet.

The servlet includes the following features:

  • logging of searches (so webmasters can determine what their customers are looking for)
  • google like interface
  • default high weighting of meta data (keywords, title & summary/description) - so that webmasters/authors who put these to good use are rewarded appropriately
  • search by author and other fields via advanced search functionality


If you need to read up up servlets, my best advice is to look over at the Sun Java Tutorials for servlets or consult the documentation for your servlet engine or J2SE/J2EE application server.

For more information about Lucene you can go to the Lucene website.