Installation

This documentation gives step-by-step instructions on how to use the SRCH2 engine to setup a simple search service on movie information. The provided package includes a sample data file with movie records, with information such as title, year, director, and genre. A live demo is available at here.

1. Download

Step 1: Download the latest SRCH2 engine by filling the form at here. Unzip it to a folder, e.g., "/home/joe/srch2". The tar ball includes the following files and a folder:

The "example-demo" folder contains files for a demo, in which we use the engine to build a search service on sample movie information. The folder includes a JSON file, sample configuration XML files for the engine, and files for two front-end UIs, one basic interface and one advanced interface.

Step 2: Open the file example-demo/srch2-config.xml, and change the variable "srch2Home" to the "example-demo" folder, e.g., "/home/joe/srch2/example-demo".

Step 3: Go to the install folder and run the following:

 /home/joe/srch2/example-demo> ../bin/srch2-engine --config-file=./srch2-config.xml

The server will read the configuration file, load the data in the corresponding data file, build indexes, and start a RESTful server. You should see a page similar to the following:

 /home/joe/srch2/example-demo> ../bin/srch2-engine --config-file=./srch2-config.xml
 2014-08-05 15:31:39 INFO  Creating indexes from JSON file...
 2014-08-05 15:31:39 INFO                                                        
 2014-08-05 15:31:39 INFO  Indexed 243 / 243 records.
 2014-08-05 15:31:39 INFO  Saving Indexes ...
 2014-08-05 15:31:39 INFO  Indexes saved.
 2014-08-05 15:31:39 INFO  Starting Srch2 server with 2 serving threads at 0.0.0.0:8081

Note:

Step 5: To test the engine, open a new terminal and type the following command:

 /home/joe/srch2/example-demo> curl -i  http://127.0.0.1:8081/search?q=terminator

You should see the following results:

{
  "estimated_number_of_results": 2,
  "fuzzy": 1,
  "limit": 2,
  "message": "NOTICE : topK query",
  "offset": 0,
  "payload_access_time": 0,
  "query_keywords": [
    "terminator"
  ],
  "query_keywords_complete": [
    false
  ],
  "results": [
    {
      "edit_dist": [
        0
      ],
      "matching_prefix": [
        "terminator"
      ],
      "record_id": "156005",
      "score": 8.08593750,
      "record": {
        "id": "156005",
        "director": "James Cameron",
        "genre": "Action",
        "id": "156005",
        "title": "The Terminator",
        "year": "1984"
      },
      "snippet": [

      ]
    },
    {
      "edit_dist": [
        0
      ],
      "matching_prefix": [
        "terminator"
      ],
      "record_id": "755010",
      "score": 8.08593750,
      "record": {
        "id": "755010",
        "director": "James Cameron",
        "genre": "Science Fiction",
        "id": "755010",
        "title": "Terminator 2",
        "year": "1991"
      },
      "snippet": [

      ]
    }
  ],
  "results_found": 2,
  "searcher_time": 0,
  "type": 0
}


2. Simple UI

Use a browser to open the file example-demo/basic/index.html. Type into the search box. After typing a few characters you should see results similar to the following:

3. Advanced UI

Use the browser to open the file example-demo/advanced/index.html. Do a search, and you should see a page similar to the following:

The screen has the following regions:

  1. It is the main search box.

  2. It shows the search results.

  3. It allows the user to specify the order in which the results are sorted using the "year" field.

  4. It allows the user to specify filters to post-process results, e.g., "year in the interval [2001, 2004]".

  5. It allows the user to specify a facet on the year field by providing a start year, an end year, and a year gap;

  6. It shows the facet results.

Note: Each time we make changes to some conditions, make sure to move the focus to the search box and move the cursor to reissue the search query to the server in order to see the new results.

This interface shows the powerful features of the engine. Next we will explain what's happening under the hood.