Details

Building Sensei

Getting the Sensei source code and building the entire system is straightforward. Only two commands are needed:

  1. Checking out the source code from trunk:

      $ git clone git://github.com/javasoze/sensei.git sensei-trunk
                
  2. Building Sensei using ant:

      $ ant

Starting ZooKeeper

In order to run the sample of Sensei search, you have to run an instance of ZooKeeper first.

You may download ZooKeeper from http://hadoop.apache.org/zookeeper/.

Using the sample configuration file in zookeeper-3.2.0/conf by copying zookeeper-3.2.0/conf/zoo_sample.cfg to zookeeper-3.2.0/conf/zoo.cfg and start an instance of ZooKeeper by running

  $ zookeeper-3.2.0/bin/zkServer.sh start

For details, see http://hadoop.apache.org/zookeeper/docs/current/zookeeperStarted.html.

Starting Sensei Nodes

You can use command bin/start-sensei-node.sh to start a server node. This command takes one argument: conf.dir, which contains all configuration information for a given Sensei node.

Here is an example command-line that will work to fire up a single sensei node with some sample data:

  $ bin/start-sensei-node.sh conf

Note

Do not expect to see any logs after running this command. If you run it, have ZooKeeper up and running, a REST server (as discussed below) will also be started, and you will be able to get some sample search results.

Web Application and RESTful End-Point

When developing applications using Sensei, we found it convenient to have a RESTful end-point that provides data in JSON format. Having a RESTful end-point allows one to query the Sensei system in an ad-hoc way, and having a JSON formatted output provides a way to investigate the result set without having the need to depend on jars or any other types of code binding.

When a Sensei node is started, a RESTful end-point along with a web interactive client would be started as well:

  • RESTful end-point:

      http://localhost:8080/sensei?q=
  • Web client

      http://localhost:8080

Starting Clients

After you start at least one node, you can run

  $ bin/sensei-client.sh client-conf

to start a client. You can edit client-conf/sensei-client.conf to change the properties.

Type help to see command list:

  $ bin/sensei-client.sh client-conf
  > help
  help - prints this message
  exit - quits
  info - prints system information
  query <query string> - sets query text
  facetspec <name>:<minHitCount>:<maxCount>:<sort> - add facet spec
  page <offset>:<count> - set paging parameters
  select <name>:<value1>,<value2>... - add selection, with ! in front of value indicates a not
  sort <name>:<dir>,... - set sort specs
  showReq: shows current request
  clear: clears current request
  clearSelections: clears all selections
  clearSelection <name>: clear selection specified
  clearFacetSpecs: clears all facet specs
  clearFacetSpec <name>: clears specified facetspec
  browse - executes a search
  >