[Previous: What's New] [Contents] [Next: Terrier Components]

Installing and Running Terrier

If you are interested to use Terrier straight away in order to index and retrieve from standard test collections, then you may follow the steps described below. We provide step-by-step instructions for the installation of Terrier on Linux and Windows operating systems and guide you through your first indexing and retrieval steps on the TREC WT2G test collection.

Terrier Requirements

Terrier's single requirement consists of an installed Java JRE 1.5.0 or higher. You can download the JRE, or the JDK (if you want to develop with Terrier), from the Sun Java website.

Download Terrier

A copy of Terrier version 2.2 can be downloaded from the University of Glasgow at the following location: [Terrier Home]. The site offers pre-compiled releases of the newest and previous Unix and Windows versions of Terrier.

Step by Step Unix Installation

After having downloaded Terrier, copy the file to the directory where you want to install Terrier. Navigate to this directory and execute the following two commands to unzip and untar the binary:

gunzip terrier-2.2.tar.gz
tar -xvf terrier-2.2.tar

This will result in the creation of a terrier directory in your current directory. Next we will have to make sure that you have the correct Java version available on the system. Type:

echo $JAVA_HOME

If the environment variable $JAVA_HOME is set, this command will output the path of your Java installation. (e.g. /usr/java/jre1.5.0). If this command shows that you have a correct Java version (1.5.0 or higher) installed then your all done. If your system does not meet these requirements you can download a Java 1.5 from the Sun JRE 1.5 Linux download website and set the environment variable by including the following line either in your /etc/profile or ~/.bashrc files:

export JAVA_HOME="Absolute_Path_of_Java_Installation"

Step by Step Windows Installation

In order to be able to use Terrier you simply have to extract the contents of the downloaded Zip file into a directory of your choice. Terrier requires Java version 1.5 or higher. If your system does not meet this requirements you can download an appropriate version from the Sun JRE download website.

Using Terrier

Terrier comes with three applications:

Batch (TREC) Terrier

This allows you to easily index, retrieve, and evaluate results on TREC collections. In the next paragraph we provide you with a step-by-step tutorial of how to use this application.

Interactive Terrier

This allows you to to do interactive retrieval. This is a quick way to test Terrier. Given that you have installed Terrier on Windows you can start Interactive Terrier by executing the interactive_terrier.bat file in Terrier's bin directory. On a Unix system or Mac you can run interactive Terrier by executing the interactive_terrier.sh file. You can configure the retrieval functionalities of InteractiveTerrier using properties described in the InteractiveQuerying class.

Desktop Terrier

A sample Desktop search application. If you are interested in getting to know more about it you should take a look at its tutorial.

Tutorial: How to use the Batch (TREC) Terrier

Indexing

This guide will provide step-by-step instructions for using Terrier to index a TREC collection. We assume that the operating system is Linux, and that the collection, along with the topics and the relevance assessments (qrels), is stored in the directory /local/ir.collections2/WT2G/.

1. Go to the Terrier folder.

cd terrier

2. Setup Terrier for using a TREC test collection by calling

./bin/trec_setup.sh "Absolute_Path_To_Collection_Files"
in our example:
./bin/trec_setup.sh /local/ir.collections2/WT2G/

This will result in the creation of a collection.spec file containing a list of the files in the specified directory in the "etc" directory.

3. If necessary, modify the collection.spec file. This might be required if the collection directory contained files that you don't want to index. You can do this by using:

find /local/ir.collections2/WT2G/ -type f | grep -v info > etc/collection.spec

4. Now we are ready to actually begin the indexing of the collection.

./bin/trec_terrier.sh -i

  NB: If you don't need the direct file, e.g. for query expansion, then you can use bin/trec_terrier.sh -i -j for the faster single-pass indexing introduced for Terrier 2.0

5. If we want to use Ponte & Croft's language modelling approach, we need to direct Terrier to build additional indices using the "-l" parameter.

./bin/trec_terrier.sh -i -l

Retrieval

In order to perform retrieval from the just indexed test collection, follow the steps described below.

1. First of all we have to do some configuration. You can either manually edit the trec.topics.list file in the etc directory or make use of the following command.

echo /local/ir.collections2/WT2G/info/topics.401-450 >> etc/trec.topics.list

2. Next we have to specify where Terrier will find the query relevance assessments file. You can do this by calling:

echo /local/ir.collections2/WT2G/info/qrels.trec8.small_web.gz >> etc/trec.qrels

3. Now we specify the retrieval model we want to use. In this case we will use the DFR model called PL2 for ranking documents.

echo uk.ac.gla.terrier.matching.models.PL2 > etc/trec.models

4. Now we will start retrieval and also set a parameter (i.e the c parameter of the model to the value of 10.99) from the command line. The "-r" parameter instructs Terrier to perform retrieval. The "-c" option is used to specify the value of the "c" parameter. (To learn more about the model see the description of the DFR framework).

./bin/trec_terrier.sh -r -c 10.99

If all goes well this will result in a .res file in the var/results directory called: InL2c10.99_0.res.

5. Now we will evaluate the obtained results by using the "-e" parameter.

./bin/trec_terrier.sh -e

Terrier will look at the var/results directory, evaluate each .res file and save the output in a .eval file named the same as the corresponding .res file.

2. Now we will perform retrieval again but this time we enable query expansion (QE) by using the "-r" parameter. See Information Retrieval Wiki page on Query Expansion for more information about QE. Note that your index must have a direct index structure to support QE. A direct index is built by not built by default by single-pass indexing (see Configuring Indexing for more information). Afterwards we can run the evaluation again by using trec_terrier.sh with the "-e" parameter.

./bin/trec_terrier.sh -r -q -c 10.99
./bin/trec_terrier.sh -e

5. Now we can look at all the Mean Average Precision (MAP) values of the runs by executing:

tail -1 var/results/*.eval

The obtained MAP for the first run should be 0.3140.

The obtained MAP for the run using query expansion should be 0.3305

[Previous: What's New] [Contents] [Next: Terrier Components]