|
6 | 6 |
|
7 | 7 | <h4 align="center">
|
8 | 8 | <a href="https://github.com/meilisearch/MeiliSearch">MeiliSearch</a> |
|
| 9 | + <a href="https://docs.meilisearch.com">Documentation</a> | |
9 | 10 | <a href="https://www.meilisearch.com">Website</a> |
|
10 | 11 | <a href="https://blog.meilisearch.com">Blog</a> |
|
11 | 12 | <a href="https://twitter.com/meilisearch">Twitter</a> |
|
12 |
| - <a href="https://docs.meilisearch.com">Documentation</a> | |
13 | 13 | <a href="https://docs.meilisearch.com/faq">FAQ</a>
|
14 | 14 | </h4>
|
15 | 15 |
|
|
19 | 19 | <a href="https://github.com/meilisearch/MeiliSearch/discussions" alt="Discussions"><img src="https://img.shields.io/badge/github-discussions-red" /></a>
|
20 | 20 | </p>
|
21 | 21 |
|
22 |
| -<p align="center"> |
23 |
| - ⚡ Lightning Fast, Ultra Relevant, and Typo-Tolerant Search Engine MeiliSearch client written in Java |
24 |
| -</p> |
| 22 | +<p align="center">⚡ The MeiliSearch API client written for Java</p> |
25 | 23 |
|
26 |
| -<hr> |
| 24 | +**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. |
27 | 25 |
|
28 | 26 | ### ⚠️ Important!: this is WIP, and not available for production ⚠️
|
29 | 27 |
|
30 | 28 | ## Table of Contents <!-- omit in toc -->
|
31 | 29 |
|
| 30 | +- [📖 Documentation](#-documentation) |
32 | 31 | - [🔧 Installation](#-installation)
|
33 |
| -- [🚀 Getting started](#-getting-started) |
| 32 | +- [🚀 Getting Started](#-getting-started) |
34 | 33 | - [🤖 Compatibility with MeiliSearch](#-compatibility-with-meilisearch)
|
35 |
| -- [🎬 Examples](#-examples) |
| 34 | +- [💡 Learn More](#-learn-more) |
36 | 35 | - [⚙️ Development Workflow and Contributing](#️-development-workflow-and-contributing)
|
37 | 36 |
|
38 |
| -# meilisearch-java |
39 |
| - |
40 |
| -Java client for MeiliSearch. |
41 |
| - |
42 |
| -MeiliSearch provides an ultra relevant and instant full-text search. Our solution is open-source and you can check out [our repository here](https://github.com/meilisearch/MeiliSearch). |
| 37 | +## 📖 Documentation |
43 | 38 |
|
44 |
| -Here is the [MeiliSearch documentation](https://docs.meilisearch.com/) 📖 |
| 39 | +See our [Documentation](https://docs.meilisearch.com/guides/introduction/quick_start_guide.html) or our [API References](https://docs.meilisearch.com/references/). |
45 | 40 |
|
46 | 41 |
|
47 | 42 | ## 🔧 Installation
|
48 | 43 |
|
49 | 44 | // TODO:
|
50 | 45 |
|
51 | 46 |
|
52 |
| -## 🚀 Getting started |
| 47 | +## 🚀 Getting Started |
| 48 | + |
| 49 | +#### Add documents <!-- omit in toc --> |
53 | 50 |
|
54 |
| -#### Quickstart |
55 | 51 | ```java
|
56 |
| -import com.meilisearch.sdk.Config; |
57 | 52 | import com.meilisearch.sdk.Client;
|
| 53 | +import com.meilisearch.sdk.Config; |
| 54 | +import com.meilisearch.sdk.Index; |
| 55 | + |
| 56 | +public class Main { |
| 57 | + |
| 58 | + public static void main(String[] args) throws Exception { |
| 59 | + |
| 60 | + final String documents = "[" |
| 61 | + + "{\"book_id\": 123, \"title\": \"Pride and Prejudice\"}," |
| 62 | + + "{\"book_id\": 456, \"title\": \"Le Petit Prince\"}," |
| 63 | + + "{\"book_id\": 1, \"title\": \"Alice In Wonderland\"}," |
| 64 | + + "{\"book_id\": 1344, \"title\": \"The Hobbit\"}," |
| 65 | + + "{\"book_id\": 4, \"title\": \"Harry Potter and the Half-Blood Prince\"}," |
| 66 | + + "{\"book_id\": 2, \"title\": \"The Hitchhiker\'s Guide to the Galaxy\"}" |
| 67 | + + "]"; |
| 68 | + |
| 69 | + Client client = new Client(new Config("http://localhost:7700", "masterKey")); |
| 70 | + Index index = client.createIndex("books"); // If your index does not exist |
| 71 | + Index index = client.getIndex("books"); // If you already created your index |
| 72 | + |
| 73 | + index.addDocuments(documents); |
| 74 | + } |
58 | 75 |
|
59 |
| -public class TestApp { |
60 |
| - |
61 |
| - public static void main(String[] args) throws Exception { |
62 |
| - Client ms = new Client(new Config("http://localhost:7700", "")); |
63 |
| - |
64 |
| - // create new Index with primary key(optional) |
65 |
| - ms.createIndex("books", "books_id"); |
66 |
| - |
67 |
| - Indexes book = ms.getIndex("books"); |
68 |
| - |
69 |
| - JsonArray jsonArray = new JsonArray(); |
70 |
| - JsonObject jsonObject = new JsonObject(); |
71 |
| - jsonObject.addProperty("1111", "alice in wonderland"); |
72 |
| - jsonArray.add(jsonObject); |
73 |
| - |
74 |
| - // add new document "[{"1111": "alice in wonderland"}]" |
75 |
| - String response = book.addDocuments(jsonObject.toString()); |
76 |
| - |
77 |
| - // response : "{ "updateId": 0 }" |
78 |
| - } |
79 | 76 | }
|
80 | 77 | ```
|
81 | 78 |
|
82 |
| -## 🤖 Compatibility with MeiliSearch |
| 79 | +#### Basic Search <!-- omit in toc --> |
83 | 80 |
|
84 |
| -This package is compatible with the following MeiliSearch versions: |
85 |
| -- `v0.14.X` |
86 |
| -- `v0.13.X` |
| 81 | +```java |
| 82 | + // MeiliSearch is typo-tolerant: |
| 83 | + String results = index.search("harry pottre"); |
| 84 | + System.out.println(results); |
| 85 | +``` |
| 86 | + |
| 87 | +Output: |
| 88 | +```json |
| 89 | +{ |
| 90 | + "hits": [{ |
| 91 | + "book_id": 4, |
| 92 | + "title": "Harry Potter and the Half-Blood Prince" |
| 93 | + }], |
| 94 | + "offset": 0, |
| 95 | + "limit": 20, |
| 96 | + "nbHits": 1, |
| 97 | + "exhaustiveNbHits": false, |
| 98 | + "processingTimeMs": 2, |
| 99 | + "query": "harry pottre" |
| 100 | +} |
| 101 | +``` |
87 | 102 |
|
88 |
| -## 🎬 Examples |
| 103 | +#### Custom Search <!-- omit in toc --> |
89 | 104 |
|
90 | 105 | // TODO:
|
91 | 106 |
|
| 107 | +## 🤖 Compatibility with MeiliSearch |
| 108 | + |
| 109 | +This package only guarantees the compatibility with the [version v0.15.0 of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases/tag/v0.15.0). |
| 110 | + |
| 111 | +## 💡 Learn More |
| 112 | + |
| 113 | +The following sections may interest you: |
| 114 | + |
| 115 | +- **Manipulate documents**: see the [API references](https://docs.meilisearch.com/references/documents.html) or read more about [documents](https://docs.meilisearch.com/guides/main_concepts/documents.html). |
| 116 | +- **Search**: see the [API references](https://docs.meilisearch.com/references/search.html) or follow our guide on [search parameters](https://docs.meilisearch.com/guides/advanced_guides/search_parameters.html). |
| 117 | +- **Manage the indexes**: see the [API references](https://docs.meilisearch.com/references/indexes.html) or read more about [indexes](https://docs.meilisearch.com/guides/main_concepts/indexes.html). |
| 118 | +- **Configure the index settings**: see the [API references](https://docs.meilisearch.com/references/settings.html) or follow our guide on [settings parameters](https://docs.meilisearch.com/guides/advanced_guides/settings.html). |
| 119 | + |
92 | 120 | ## ⚙️ Development Workflow and Contributing
|
93 | 121 |
|
94 | 122 | Any new contribution is more than welcome in this project!
|
|
0 commit comments