MeiliSearch | Documentation | Website | Blog | Twitter | FAQ
⚡ 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.
- 📖 Documentation
- 🔧 Installation
- 🚀 Getting Started
- 🤖 Compatibility with MeiliSearch
- 💡 Learn More
- ⚙️ Development Workflow and Contributing
See our Documentation or our API References.
// TODO:
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);
}
}
// 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"
}
// TODO:
This package only guarantees the compatibility with the version v0.15.0 of MeiliSearch.
The following sections may interest you:
- Manipulate documents: see the API references or read more about documents.
- Search: see the API references or follow our guide on search parameters.
- Manage the indexes: see the API references or read more about indexes.
- Configure the index settings: see the API references or follow our guide on settings parameters.
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.