:: EGOTHOR

Querying via the Egothor Webapp

Introduction. 

You can now use the Tomcat server to search locally indexed files. Doing this will require you to follow 2 procedures (once you've checked out Egothor):

Building the Webapp. 

This last step will create a file named something like egothor-web-1.2.3.war in the tmp/dist directory of your Egothor directory. Move this file to the webapps directory of your Tomcat installation and navigate your browser to http://localhost:[your port number, the default being 8080]/egothor-web-1.2.3, and you should see a page that looks like this:

Figure 3.1. Egothor Webapp

Egothor Webapp

What Ant does for you here is, in order:

  1. compile and jar the Egothor source code
  2. run javadoc on the source code so that the indexer has something to index
  3. construct the webapp and index the Egothor docs created in the previous task

If all went well you should be able to search the Egothor Javadocs to see the use and functionality of the Egothor search engine.

Using Your Own Index. 

While this may be interesting at first, you, no doubt, want to be able to search your own documents. If you look inside the Egothor webapp you should see a directory named indices, inside of which is a directory named index.api. This last directory contains the folders which hold the actual indices of the Javadocs. It is these indices which Egothor uses while searching for a user's search terms.

In order to find the indices, Tomcat uses the search-contexts.xml file in the WEB-INF directory of the Egothor webapp. The demo app context looks something like this:

<search-context id="egothor-docs"> <name>Egothor API docs (pre-installed demo)</name> <tanker> <location> <!-- either 'webapp-relative' or 'absolute' nodes here --> <webapp-relative>/indices/index.api</webapp-relative> </location> </tanker> </search-context>

Setting up your own index is exactly that straightforward. Index you files (for more information on indexing see here[insert link]. Put the index (indices) inside your webapp and add a context to search-contexts.xml. As you can see, the most important step is supplying the location of your index, so be careful when adding the path so that Tomcat can see it.

If you don't want to put your index inside Tomcat then your context should look like this:

<search-context id="egothor-docs"> <name>Egothor API docs (pre-installed demo)</name> <tanker> <location> <!-- either 'webapp-relative' or 'absolute' nodes here --> <absolute>full/path/to/your/index</absolute> </location> </tanker> </search-context>

Notice that the only difference between the two is the absolute or webapp-relative tag, depending on where you want to locate your index

By default, the Tanker implementation used in the Webapp will (should) reload itself if new documents are added to the index. However, should any problems occur, there exists an option for a search-context to force re-creation of a new tanker for each query. This is an overkill, so it is by default disabled. If you have any problems with Tankers failing, uncomment this option -- it'll degrade performance, but probably increase Egothor's stability.

A per-quer reloadable search context definition can look as shown below:

<search-context id="egothor-docs"> <name>Egothor API docs (pre-installed demo)</name> <reloadable /> <tanker> <location> <!-- either 'webapp-relative' or 'absolute' nodes here --> <absolute>full/path/to/your/index</absolute> </location> </tanker> </search-context>

Start Tomcat and you should be able to search your content.

Adding keywords to user queries. 

If you want to access advanced Egothor features, accessible via parameters inside the query, you can use a special tag query-extension inside a context definition:

<search-context id="egothor-docs"> <name>Egothor API docs (pre-installed demo)</name> <query-extension> <text><![CDATA[<!VOLATILE>depthrank <!VOLATILE>linksrank ^^ $boost$]]></text> <variable name="boost" default="25" /> </query-extension> <tanker> <location> <!-- either 'webapp-relative' or 'absolute' nodes here --> <absolute>full/path/to/your/index</absolute> </location> </tanker> </search-context>

You can now use variables that are replaced in the query extension at runtime. All variables are textual and are surrounded with a dollar ($) sign, see example above. If a http request contains parameter that matches the name of the variable, it will be replaced with the value from the request, here for example: http://myegothor.org/search?q=myquery&boost=15

Prev Up Next
How to Form a Query Home Querying via Ant
© 2003-2004 Egothor Developers