Java SDK

The SearchUnify SDK for Java enables developers to build scalable solutions based on SearchUnify search, analytics, and crawlers. You can start in minutes using Maven or by downloading the JAR file.

Prerequisite

Ensure that your profile is in the right scope. Refer to Change User Scope (API and SDK).

How it works

The SearchUnify SDK for Java simplifies use of SearchUnify Services by providing a set of libraries that are consistent and familiar to Java developers. It provides support for the entire API life-cycle, including credential management, data marshaling, and serialization. The SDK supports higher level abstractions for simplified development.

Key Features

  • HTTP/2 Support and pluggable HTTP layer. New programming interfaces that take advantage of HTTP/2 features and provide new ways to build applications.

  • Nonblocking I/O. A new, nonblocking SDK architecture supports a true nonblocking I/O and asynchronous clients that implement high concurrency across a few threads.

Getting Started

Sign up with SearchUnify, check your system to ensure that it meets the minimum technical requirements, install the SDK, and initialize it before consuming the SearchUnify SDK for Java.

Sign up for SearchUnify

Get a SearchUnify account. Refer to the oAuth section of the developer guide for information about how to retrieve your SearchUnify credentials. Place the link to the section here.

Minimum Requirements

  • JDK 1.8+

  • Maven 3.0

Install Java SDK

The recommended way to use the SearchUnify SDK for Java in your project is to consume it from Maven. Import the JAR and specify the SDK Maven modules that your project needs in <dependencies>.

Copy

Maven <dependencies>

<dependencies>
  <dependency>
    <groupId>com.searchunify</groupId>
    <artifactId>sdk</artifactId>
    <version>1.0</version>
  </dependency>
</dependencies>

Initialize Java SDK Client

Before using the SDK, initialize your client. You can access SearchUnify analytics, content and search from the client after initialization. The access token expires in 4 hours and needs to be refreshed.

Copy

Initialize Java SDK

import com.searchunify.sdk.SearchUnifyClient;

/**
 * @author Fyodor Dostoevsky
 * @created 30-Mar-2022
 */
public class App {

    private SearchUnifyClient client;

    public App() {
        String key = "key";
        String secret = "secret";
        String baseContext = "https://yourcompany.searchunify.com";
        String username = "changeme";
        String password = "changeme";
        this.client = new SearchUnifyClient(key, secret, baseContext, username, password, "password");
    }
}

Analytics

To access analytics data you can use the analytics methods provided by SearchUnify Java SDK. There are around 22 methods.

Content

This section includes the methods for content source SDKs.

Search

SDK has a search API to make content searchable. You just need to pass parameters as per requirement.