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.
- 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.
- 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.
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.
How to use
- 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: