Search Engine Studio FAQ

Question ID:
Q2034
Question:
How do I set up the search servlet?
 
Servlet set-up steps for a Tomcat server

Here are the sample output options you'll need to set up. Please note that these options assume you're uploading the output files to your server via FTP (options/output/upload output to an ftp server). If not uploading to an FTP server, the physical ouput locations below should start with e.g. c:\... or \\server\...

This sample also illustrates adding the search servlet to the default application (usually to the ROOT directory inside the webapps directory (.../webapps/ROOT/) or this could simply be the website root - e.g. .../htdocs/).

  • options/output/target type: Java servlet
  • options/output/http paths../cgi-search scripts directory: We'll set this to the root directory: / (please note that for older Tomcat versions you might need to set this to /servlet)
  • options/output/physical location../output directory for search box page files: [main website directory], e.g.: htdocs or .../webapps/ROOT
  • options/output/physical location../output directory for CGI/search scripts: [WEB-INF/lib directory], e.g.: htdocs/WEB-INF/lib or .../webapps/ROOT/WEB-INF/lib
  • options/search engine/filename of the cgi script: SESSearchServlet
When the directories are properly set up, you should generate the output files. Usually it will also be necessary to modify the web.xml file inside the WEB-INF directory to add a mapping to the servlet. Once you open this file, insert the following servlet and servlet-mapping tags inside the web-app tag:
<web-app ...>
...
<servlet>
	<servlet-name>SESSearchServlet</servlet-name>
	<servlet-class>com.xtreeme.search.SESSearchServlet</servlet-class>
</servlet>

<servlet-mapping>
	<servlet-name>SESSearchServlet</servlet-name>
	<url-pattern>/SESSearchServlet</url-pattern>
</servlet-mapping>

...
</web-app>
Once on the server, you can test the search by pointing your browser to e.g. http://your_server_address/search.htm or http://your_server_address/SESSearchServlet (for older Tomcat versions try http://your_server_address/servlet/SESSearchServlet).

To update the search, you will simply need to re-upload the updated files or have the program do it for you (without any further changes).

Servlet set-up steps for Sun J2EE Application Server on Windows

As with the Tomcat sample above, first you'll need to set up program options. We will create a temporary directory used as deployment source location, e.g. c:\searchfiles. Now set up the options:

  • options/output/target type: Java servlet
  • options/output/http paths../cgi-search scripts directory: /ses
  • options/output/physical location../output directory for search box page files: c:\searchfiles
  • options/output/physical location../output directory for CGI/search scripts: c:\searchfiles
  • options/search engine/filename of the cgi script: SESSearchServlet
When the directories are properly set up, you should generate the output files. Now, you will need to start the server, then start the deployment tool (deploytool) -- you can use the icon in the Start Menu (Sun Microsystems / Application Server / deploytool).

Once in the deploytool, choose from the menu: file / new / web component. The New Web Component wizard will show up.

Now fill out the following options:

  • WAR location: create new stand-alone WAR module
  • WAR naming / WAR file: click browse, browse to c:\searchfiles, then as filename enter: ses.war, click 'create module file'.
  • WAR naming / WAR display name: ses
  • context root: /ses
Now click 'Edit contents'.

For each file in the top tree (in c:\searchfiles), select it and click 'add' (make sure you do this for every file). Then, select all added files in the bottom tree, and move them from the root to 'WEB-INF/lib'. When all files from c:\searchfiles show up under WEB-INF/lib, click OK to close the contents window.

Click 'Next', as 'Type of web component' select 'Servlet', then click 'Next'.

In 'Servlet Class', select from the list: 'com.xtreeme.search.SESSearchServlet'. The other options get filled out automatically: 'Web component name' and 'Web component display name' should be set to 'SESSearchServlet'.

Once the web component is added, select the SESSearchServlet servlet from the tree on the left and click on the 'Aliases' tab, then add an alias: '/SESSearchServlet'.

Now select the 'ses' application from the tree on the left, and choose 'deploy' from the tools menu. Save changes if necessary (click save and deploy), then continue with deployment.

Once the servlet gets deployed, you can test the search by entering into your browser e.g.: http://localhost:8080/ses/SESSearchServlet

Whenever you want to update the search, you'll need to re-create the files using SES and save them again in c:\searchfiles, then re-deploy (this may require restarting the J2EE server) to make sure the new files are correctly used by the servlet.