Skip to content

Commit d46b89e

Browse files
authored
Merge branch 'main' into main
2 parents 41dc3d1 + 5e0caf7 commit d46b89e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1291
-214
lines changed

.code-samples.meilisearch.yaml

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -452,25 +452,23 @@ typo_tolerance_guide_4: |-
452452
};
453453
typoTolerance.setMinWordSizeForTypos(minWordSizeTypos);
454454
client.index("movies").updateTypoToleranceSettings(typoTolerance);
455-
getting_started_add_documents_md: |-
456-
**Maven**
457-
Add the following code to the `<dependencies>` section of your project:
458-
```xml
459-
<dependency>
460-
<groupId>com.meilisearch.sdk</groupId>
461-
<artifactId>meilisearch-java</artifactId>
462-
<version>0.14.0</version>
463-
<type>pom</type>
464-
</dependency>
465-
```
466-
467-
**Gradle**
468-
Add the following line to the `dependencies` section of your `build.gradle`:
469-
```groovy
470-
implementation 'com.meilisearch.sdk:meilisearch-java:0.14.0'
471-
```
472-
473-
```java
455+
getting_started_add_documents: |-
456+
// For Maven:
457+
// Add the following code to the `<dependencies>` section of your project:
458+
//
459+
// <dependency>
460+
// <groupId>com.meilisearch.sdk</groupId>
461+
// <artifactId>meilisearch-java</artifactId>
462+
// <version>0.14.7</version>
463+
// <type>pom</type>
464+
// </dependency>
465+
466+
// For Gradle
467+
// Add the following line to the `dependencies` section of your `build.gradle`:
468+
//
469+
// implementation 'com.meilisearch.sdk:meilisearch-java:0.14.7'
470+
471+
// In your .java file:
474472
import com.meilisearch.sdk;
475473
import java.nio.file.Files;
476474
import java.nio.file.Path;
@@ -480,17 +478,10 @@ getting_started_add_documents_md: |-
480478
Client client = new Client(new Config("http://localhost:7700", "aSampleMasterKey"));
481479
Index index = client.index("movies");
482480
index.addDocuments(moviesJson);
483-
```
484-
485-
[About this SDK](https://github.com/meilisearch/meilisearch-java)
486481
getting_started_check_task_status: |-
487482
client.getTask(0);
488-
getting_started_search_md: |-
489-
```java
483+
getting_started_search: |-
490484
client.index("movies").search("botman");
491-
```
492-
493-
[About this SDK](https://github.com/meilisearch/meilisearch-java)
494485
getting_started_add_meteorites: |-
495486
import com.meilisearch.sdk;
496487
import org.json.JSONArray;
@@ -827,3 +818,28 @@ get_similar_post_1:
827818
.setId("143")
828819
.setEmbedder("manual");
829820
client.index("movies").searchSimilarDocuments(query)
821+
search_parameter_reference_distinct_1: |-
822+
SearchRequest searchRequest = SearchRequest.builder().q("QUERY TERMS").distinct("ATTRIBUTE_A").build();
823+
client.index("INDEX_NAME").search(searchRequest);
824+
distinct_attribute_guide_filterable_1: |-
825+
Settings settings = new Settings();
826+
settings.setFilterableAttributes(new String[] {"product_id", "SKU", "url"});
827+
client.index("products").updateSettings(settings);
828+
distinct_attribute_guide_distinct_parameter_1: |-
829+
SearchRequest searchRequest = SearchRequest.builder().q("white shirt").distinct("sku").build();
830+
client.index("products").search(searchRequest);
831+
search_parameter_reference_locales_1: |-
832+
SearchRequest searchRequest = SearchRequest.builder().q("QUERY TEXT IN JAPANESE").locales(new String[]{"jpn"}).build();
833+
client.index("INDEX_NAME").search(searchRequest);
834+
get_localized_attribute_settings_1: |-
835+
client.index("INDEX_NAME").getLocalizedAttributesSettings();
836+
update_localized_attribute_settings_1: |-
837+
LocalizedAttribute attribute = new LocalizedAttribute();
838+
attribute.setAttributePatterns(new String[] {"jpn"});
839+
attribute.setLocales(new String[] {"*_ja"});
840+
841+
client.index("INDEX_NAME").updateLocalizedAttributesSettings(
842+
new LocalizedAttributes[] {attribute}
843+
);
844+
reset_localized_attribute_settings_1: |-
845+
client.index("INDEX_NAME").resetLocalizedAttributesSettings();

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ updates:
88
- 'skip-changelog'
99
- 'dependencies'
1010
rebase-strategy: disabled
11+
groups:
12+
github-actions:
13+
patterns:
14+
- "*"
1115

1216
- package-ecosystem: gradle
1317
directory: "/"
@@ -19,3 +23,11 @@ updates:
1923
- skip-changelog
2024
- dependencies
2125
rebase-strategy: disabled
26+
groups:
27+
gradle-plugins:
28+
patterns:
29+
- "io.github.gradle-nexus.publish-plugin*"
30+
- "com.diffplug.spotless*"
31+
gradle-dependencies:
32+
patterns:
33+
- "*"

.github/workflows/ossrh-publish.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish to Maven Central
2+
3+
on:
4+
push:
5+
tags: ["v*"] # Trigger on version tag pushes (adjust as needed)
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check out code
12+
uses: actions/checkout@v4
13+
14+
- name: Set up JDK 17
15+
uses: actions/setup-java@v4
16+
with:
17+
distribution: 'temurin'
18+
java-version: '17'
19+
20+
- name: Publish to Sonatype Central
21+
env:
22+
# Pass Sonatype portal token credentials to Gradle
23+
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
24+
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
25+
MAVEN_CENTRAL_SIGNING_KEY: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY }}
26+
MAVEN_CENTRAL_SIGNING_PASSWORD: ${{ secrets.MAVEN_CENTRAL_SIGNING_PASSWORD }}
27+
run: ./gradlew clean publishToSonatype closeAndReleaseSonatypeStagingRepository

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
path: build/reports/tests/integrationTest
3939
if-no-files-found: ignore
4040
- name: Upload coverage reports to Codecov
41-
uses: codecov/codecov-action@v4
41+
uses: codecov/codecov-action@v5
4242
env:
4343
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4444

CONTRIBUTING.md

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -199,29 +199,22 @@ gpg --gen-key --batch genkey
199199
gpg --keyserver hkp://keyserver.ubuntu.com --send-keys <last-8-digits-of-your-key-hash>
200200
```
201201

202-
5. Export the gpg key in a secring.gpg file
202+
5. Export the gpg key in a signing-key.asc armored file
203203

204204
```bash
205-
gpg --keyring secring.gpg --export-secret-keys > ~/.gnupg/secring.gpg
206-
```
207-
208-
6. Encode the secring in base64 and store it (Used by the ossrh-publish workflow)
209-
210-
```bash
211-
base64 ~/.gnupg/secring.gpg > secring.gpg.b64
205+
gpg --armor --export-secret-keys $KEY_ID > signing-key.asc
212206
```
213207

214208
#### Sign your files and upload to Maven Repository manually <!-- omit in TOC -->
215209

216210
1. Set the environment variables listed below with the required credentials:
217211

218212
```bash
219-
export OSSRH_USERNAME=<maven-username>
220-
export OSSRH_PASSWORD=<maven-password>
213+
export MAVEN_CENTRAL_USERNAME=<maven-username>
214+
export MAVEN_CENTRAL_PASSWORD=<maven-password>
221215

222216
export SIGNINT_KEY_ID=<id-associated-to-the-gpg-key>
223217
export SIGNING_PASSWORD=<passphrase-associated-to-the-gpg-key>
224-
export SIGNING_SECRET_KEY_RING_FILE=<path-to-gpg-key-encoded-in-base64>
225218
```
226219

227220
2. Decode the gpg key
@@ -235,13 +228,13 @@ base64 -d $SIGNING_SECRET_KEY_RING_FILE > secring.gpg
235228
```bash
236229
# May need sudo privilege and JDK8
237230
./gradlew build
238-
./gradlew publish -Psigning.keyId=$SIGNING_KEY_ID -Psigning.password=$SIGNING_PASSWORD -Psigning.secretKeyRingFile=$(echo secring.gpg)
231+
TODO
239232
```
240233

241-
4. Login to [Sonatype Nexus](https://oss.sonatype.org).
242-
5. Navigate to `Staging repositories`.
243-
6. Close your repository by clicking on the `Close` button. Checks will be made by nexus. It might take time. If any error occurs, it will be visible in the `Activity` tab.
244-
7. Once the check have succeeded, you should be able to click on the `Release` button. The release will be now processed and might take a long time to appear in [Maven Central](https://search.maven.org/artifact/com.meilisearch.sdk/meilisearch-java).
234+
4. Login to [Sonatype Nexus](https://central.sonatype.com/).
235+
5. Navigate to `Deployments`.
236+
6. Checks will be made by Sonatype. It might take time. If any error occurs, it will be visible in the `Deployments` tab (last one).
237+
7. Once the check have succeeded, the release will be now processed and it will appear in [Maven Central](https://central.sonatype.com/artifact/com.meilisearch.sdk/meilisearch-java/versions).
245238

246239
<hr>
247240

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020-2024 Meili SAS
3+
Copyright (c) 2020-2025 Meili SAS
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
## Table of Contents <!-- omit in TOC -->
3232

3333
- [📖 Documentation](#-documentation)
34-
- [⚡ Supercharge your Meilisearch experience](#-supercharge-your-meilisearch-experience)
3534
- [🔧 Installation](#-installation)
3635
- [🚀 Getting started](#-getting-started)
3736
- [🛠 Customization](#-customization)
@@ -47,10 +46,6 @@ For general information on how to use Meilisearch—such as our API reference, t
4746

4847

4948

50-
## ⚡ Supercharge your Meilisearch experience
51-
52-
Say goodbye to server deployment and manual updates with [Meilisearch Cloud](https://www.meilisearch.com/cloud?utm_campaign=oss&utm_source=github&utm_medium=meilisearch-java). Get started with a 14-day free trial! No credit card required.
53-
5449
## 🔧 Installation
5550

5651
`meilisearch-java` is available from JCentral official repository. To be able to import this package, declare it as a dependency in your project:
@@ -63,7 +58,7 @@ Add the following code to the `<dependencies>` section of your project:
6358
<dependency>
6459
<groupId>com.meilisearch.sdk</groupId>
6560
<artifactId>meilisearch-java</artifactId>
66-
<version>0.14.0</version>
61+
<version>0.14.7</version>
6762
<type>pom</type>
6863
</dependency>
6964
```
@@ -73,26 +68,16 @@ Add the following code to the `<dependencies>` section of your project:
7368
Add the following line to the `dependencies` section of your `build.gradle`:
7469

7570
```groovy
76-
implementation 'com.meilisearch.sdk:meilisearch-java:0.14.0'
71+
implementation 'com.meilisearch.sdk:meilisearch-java:0.14.7'
7772
```
7873

7974
:warning: `meilisearch-java` also requires `okhttp` as a peer dependency.
8075

8176
### Run Meilisearch <!-- omit in toc -->
8277

83-
There are many easy ways to [download and run a Meilisearch instance](https://www.meilisearch.com/docs/learn/getting_started/installation).
84-
85-
For example, using the `curl` command in [your Terminal](https://itconnect.uw.edu/learn/workshops/online-tutorials/web-publishing/what-is-a-terminal/):
86-
87-
```bash
88-
# Install Meilisearch
89-
curl -L https://install.meilisearch.com | sh
90-
91-
# Launch Meilisearch
92-
./meilisearch --master-key=masterKey
93-
```
78+
⚡️ **Launch, scale, and streamline in minutes with Meilisearch Cloud**—no maintenance, no commitment, cancel anytime. [Try it free now](https://cloud.meilisearch.com/login?utm_campaign=oss&utm_source=github&utm_medium=meilisearch-java).
9479

95-
NB: you can also download Meilisearch from **Homebrew** or **APT** or even run it using **Docker**.
80+
🪨 Prefer to self-host? [Download and deploy](https://www.meilisearch.com/docs/learn/self_hosted/getting_started_with_self_hosted_meilisearch?utm_campaign=oss&utm_source=github&utm_medium=meilisearch-java) our fast, open-source search engine on your own infrastructure.
9681

9782
## 🚀 Getting started
9883

@@ -162,10 +147,10 @@ import com.meilisearch.sdk.SearchRequest;
162147

163148
// ...
164149

165-
SearchResult results = index.search(
166-
new SearchRequest("of")
167-
.setShowMatchesPosition(true)
168-
.setAttributesToHighlight(new String[]{"title"})
150+
SearchResult results = (SearchResult) index.search(
151+
new SearchRequest("of")
152+
.setShowMatchesPosition(true)
153+
.setAttributesToHighlight(new String[]{"title"})
169154
);
170155
System.out.println(results.getHits());
171156
```
@@ -231,6 +216,38 @@ index.search(
231216
"query": "wonder"
232217
}
233218
```
219+
#### Custom Search With Pagination <!-- omit in toc -->
220+
221+
```java
222+
import com.meilisearch.sdk.SearchResultPaginated;
223+
224+
// ...
225+
226+
SearchResultPaginated results = (SearchResultPaginated) index.search(
227+
new SearchRequest("wonder")
228+
.setPage(1)
229+
.setHitsPerPage(20)
230+
);
231+
```
232+
233+
```json
234+
{
235+
"hits": [
236+
{
237+
"id": 2,
238+
"title": "Wonder Woman",
239+
"genres": ["Action","Adventure"]
240+
}
241+
],
242+
"query": "wonder",
243+
"processingTimeMs": 0,
244+
"hitsPerPage": 20,
245+
"page": 1,
246+
"totalPages": 1,
247+
"totalHits": 1
248+
}
249+
```
250+
234251
## 🛠 Customization
235252

236253
### JSON <!-- omit in toc -->
@@ -274,6 +291,12 @@ Client client = new Client(config);
274291

275292
This package guarantees compatibility with [version v1.x of Meilisearch](https://github.com/meilisearch/meilisearch/releases/latest), but some features may not be present. Please check the [issues](https://github.com/meilisearch/meilisearch-java/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22+label%3Aenhancement) for more info.
276293

294+
This SDK is compatible with the following JDK versions:
295+
296+
| SDK Version | Supported Java Versions |
297+
|-------------|-------------------------|
298+
| v1.x | JDK 8 and above |
299+
277300
## 💡 Learn more
278301

279302
The following sections in our main documentation website may interest you:

0 commit comments

Comments
 (0)