/meilisearch-java

Java client for MeiliSearch

Primary LanguageJavaMIT LicenseMIT

MeiliSearch Java

MeiliSearch Java

License Slack

⚡ The MeiliSearch API client written for Java

MeiliSearch Java is the MeiliSearch API client for Java developers. MeiliSearch is a powerful, fast, open-source, easy to use and deploy search engine. Both searching and indexing are highly customizable. Features such as typo-tolerance, filters, facets and synonyms are provided out-of-the-box.

⚠️ Important!: this is WIP, and not available for production ⚠️

Table of Contents

📖 Documentation

See our Documentation or our API References.

🔧 Installation

// TODO:

🚀 Getting Started

Add documents

import com.meilisearch.sdk.Client;
import com.meilisearch.sdk.Config;
import com.meilisearch.sdk.Index;

public class Main {

	public static void main(String[] args) throws Exception {

		final String documents = "["
			+ "{\"book_id\": 123, \"title\": \"Pride and Prejudice\"},"
			+ "{\"book_id\": 456, \"title\": \"Le Petit Prince\"},"
			+ "{\"book_id\": 1, \"title\": \"Alice In Wonderland\"},"
			+ "{\"book_id\": 1344, \"title\": \"The Hobbit\"},"
			+ "{\"book_id\": 4, \"title\": \"Harry Potter and the Half-Blood Prince\"},"
			+ "{\"book_id\": 2, \"title\": \"The Hitchhiker\'s Guide to the Galaxy\"}"
			+ "]";

		Client client = new Client(new Config("http://localhost:7700", "masterKey"));
		Index index = client.createIndex("books"); // If your index does not exist
		Index index = client.getIndex("books"); // If you already created your index

		index.addDocuments(documents);
	}

}

Basic Search

	// MeiliSearch is typo-tolerant:
	String results = index.search("harry pottre");
	System.out.println(results);

Output:

{
	"hits": [{
		"book_id": 4,
		"title": "Harry Potter and the Half-Blood Prince"
	}],
	"offset": 0,
	"limit": 20,
	"nbHits": 1,
	"exhaustiveNbHits": false,
	"processingTimeMs": 2,
	"query": "harry pottre"
}

Custom Search

// TODO:

🤖 Compatibility with MeiliSearch

This package only guarantees the compatibility with the version v0.15.0 of MeiliSearch.

💡 Learn More

The following sections may interest you:

⚙️ Development Workflow and Contributing

Any new contribution is more than welcome in this project!

If you want to know more about the development workflow or want to contribute, please visit our contributing guidelines for detailed instructions!


MeiliSearch provides and maintains many SDKs and Integration tools like this one. We want to provide everyone with an amazing search experience for any kind of project. If you want to contribute, make suggestions, or just know what's going on right now, visit us in the integration-guides repository.