Quickstart

This quickstart requires a Cleo distribution of version 1.2.0 or above. The src/examples directory contains a number of classes such as GenericCompanyTypeahead and MyFriendsTypeahead. These example classes demonstrate how to develop and configure applications to perform generic or network typeahead search.

Code Examples

Restful WebApp

The cleo-primer package provides a basic RESTful implementation of partial, out-of-order and real-time typeahead and autocomplete services.

You can follow the steps below to set up a typeahead service for public companies listed at Nasdaq.

  1. Download cleo-primer from Github.
  2.   git clone --depth 1 https://github.com/jingwei/cleo-primer.git cleo-primer
      
  3. Launch the cleo-primer web application from the cleo-primer folder.
  4.   MAVEN_OPTS="-Xms1g -Xmx1g" mvn jetty:run \
      -Dcleo.instance.name=Company \
      -Dcleo.instance.type=cleo.primer.GenericTypeaheadInstance \
      -Dcleo.instance.conf=src/main/resources/config/generic-typeahead
      

    You can customize the web application by choosing different values for cleo.instance.name, cleo.instance.type, and cleo.instance.conf. Depending on the size of your data sets, you may need to specify a different JVM heap size.

    • The cleo.instance.name is assigned Company because we are building a typeahead service for companies listed at Nasdaq.
    • The cleo.instance.type specifies a Java class cleo.primer.GenericTypeaheadInstance that instantiates an instance of Generic Typeahead. This is the only instance type supported by cleo-primer at the present time. We will add more in the coming future.
    • The cleo.instance.conf specifies a file directory where several generic typeahead configuration files are located. For more information on configuring Generic Typeahead and Network Typeahead, please refer to the code examples listed above.

  5. Index Nasdaq public companies using the prepared XML file.
  6.   ./scripts/post-element-list.sh dat/nasdaq-company-list.xml
      

    If you have a different type of elements such as schools and publications, you need to prepare your XML file according to cleo.primer.rest.model.ElementDTO

  7. Visit the URL below to try out cleo-primer.
  8.   http://localhost:8080/cleo-primer