Page tree
Skip to end of metadata
Go to start of metadata

Search API's service layer will provide foundation for developers who wants to write client application for some REST based resource by allowing developer to store the resources in a schema-less storage system and access this resource as programmable objects as opposed to a REST resource.

Features:

  • Transform JSON based resources into objects.
  • Perform CRUD operation of the object into a lucene indexing system.
  • Schema-less storage provided by lucene.
  • Evolve the object structure easily by changing the way the Algorithm convert the resources.
  • Add more resources location easily by registering more Resolver classes.

Requirements:

  • Algorithm to define how to transform REST resource into the correct Java based object.
  • Resolver to define where the Search API will find the REST resources.
  • Domain object representation of the REST resource.
  • Configuration document to tie all the above together.

 

Technology Stack

The following image is the technology stack for the Search API:

  • Service: The entry point where the consumer can perform their indexing and searching process.
  • Guice Framework: Framework which will control the life cycle of every component inside the Search API. Think of it like the Spring that hold together every component in OpenMRS. Guice will inject objects based on the module configuration passed during the creation of the injector.
  • Indexer: The internal class which will perform searching and indexing process. The current implementation of the Indexer class, DefaultIndexer class, will communicate with Lucene. In the future, if we want to use other indexer, we can implement different type of Indexer and then configure Search API to use that Indexer. The configuration of which Indexer is being injected is stored in the Search Module class file.

Search API Technology Stack 

How to use

Setup

  • The easiest way to use the API is by using maven and add the search-api artifact in your pom.xml
<dependency>
<groupId>com.muzima</groupId>
<artifactId>search-api</artifactId>
<version>1.1.1</version>
</dependency>

If you prefer to add the jar files manually, you need to add the following jar files:

  • org.slf4j:slf4j-api:1.7.5
  • org.aspectj:aspectjrt:1.7.2
  • org.apache.lucene:lucene-core:3.6.1
  • com.google.inject:guice:3.0
  • javax.inject:javax.inject:1
  • com.google.inject.extensions:guice-throwingproviders:3.0
  • com.jayway.jsonpath:json-path:0.8.1
  • net.minidev:json-smart:1.1.1
  • lucene.transform:lucenetransform:0.9.2.2
  • No labels