Chapter 34. Library Sample

34.1. Introduction

Compass::Samples [library] is a basic example, that highlights the main features of Compass::Core. The application contains a small library domain model, containing Author, Article and Book Objects.

You can find most of Compass::Core features used within the library sample, such as OSEM and Common Metadata. It executes as a unit test, using JUnit and can be used to search a predefined set of data. Modify the LibraryTests class to add your own test data and experiment with how easy it is to work with Compass. Enjoy.

34.2. Running The Sample

Running the library sample, you will need to have Apache Ant installed and have ANT_HOME/bin on your path. The following table lists the available ant targets.

Table 34.1. 

usage (also the default target)Lists all the available targets.
testRuns the tests defined in the LibraryTests, also compiles sample (see the compile target).
compileCompiles the tests and the source code into the build/classes directory. Also executes the common meta data task to generate the Library class out of the library.cmd.xml file into the source directory.
searchExecutes the LibraryTests main method, which pre-populates the index with data. You can interactivly provide a search query to execute a search on the index.