Conversation
📝 WalkthroughWalkthroughDocumentation updated in README.md: Gradle syntax corrected from Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
README.md (1)
35-37:⚠️ Potential issue | 🔴 CriticalCritical: Remove broken Table of Contents links.
The Table of Contents references three sections that no longer exist in the document:
🛠 Customization(line 35)🤖 Compatibility with Meilisearch(line 36)💡 Learn more(line 37)These sections were removed as part of the documentation simplification, but the TOC was not updated accordingly. Users clicking these links will encounter broken anchors.
🔗 Proposed fix to remove broken TOC entries
- [📖 Documentation](`#-documentation`) - [🔧 Installation](`#-installation`) - [🚀 Getting started](`#-getting-started`) -- [🛠 Customization](`#-customization`) -- [🤖 Compatibility with Meilisearch](`#-compatibility-with-meilisearch`) -- [💡 Learn more](`#-learn-more`) - [⚙️ Contributing](#️-contributing)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@README.md` around lines 35 - 37, Remove the three broken Table of Contents entries from README: delete the list items linking to "🛠 Customization", "🤖 Compatibility with Meilisearch", and "💡 Learn more" so the TOC only references existing anchors; search for those exact link texts in the README and remove those bullet lines from the TOC list to prevent broken anchors.
🧹 Nitpick comments (1)
README.md (1)
68-68: Consider consistency with other Gradle code blocks in the repository.The change to use
gradleas the syntax highlighting identifier is valid and fully supported by GitHub. However,CONTRIBUTING.mdstill usesgroovyfor Gradle code blocks (lines 142, 152). For consistency across the documentation, consider updating all Gradle code blocks to use the same identifier.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@README.md` at line 68, The repository has inconsistent fenced-code block language identifiers for Gradle: README.md uses ```gradle while CONTRIBUTING.md still uses ```groovy; update the Gradle code blocks in CONTRIBUTING.md (the fences around the gradle build snippets) to use the same ```gradle identifier so all Gradle blocks are consistent across docs. Locate the Gradle examples by their fenced blocks and replace the language tag from groovy to gradle for each Gradle snippet.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@README.md`:
- Around line 74-81: The Getting Started section was trimmed to only show
Client/Config initialization (the Client and Config example), removing practical
usage examples (adding documents, basic searches, filters/pagination, and task
UID handling); restore at least two short examples: one showing how to add a
document to an index (create/get index, addDocuments or addDocumentsAsync usage)
and one showing a basic search call (search with query plus optional filter and
pagination params), placed immediately after the existing Client/Config snippet,
or alternatively add a prominent link labeled “Full getting started guide”
pointing to the more detailed external guide—ensure the examples reference the
same Client and index objects shown in the snippet and include brief notes about
handling task UIDs for async operations.
- Line 86: Add a single trailing newline at the end of README.md so the last
line ("You can help by reporting bugs, suggesting new features, or submitting
pull requests to improve the codebase and documentation.") is terminated with a
newline character; open README.md, move cursor to EOF after that sentence,
insert one newline, save the file to satisfy POSIX text file conventions and
avoid tooling/VCS issues.
---
Outside diff comments:
In `@README.md`:
- Around line 35-37: Remove the three broken Table of Contents entries from
README: delete the list items linking to "🛠 Customization", "🤖 Compatibility
with Meilisearch", and "💡 Learn more" so the TOC only references existing
anchors; search for those exact link texts in the README and remove those bullet
lines from the TOC list to prevent broken anchors.
---
Nitpick comments:
In `@README.md`:
- Line 68: The repository has inconsistent fenced-code block language
identifiers for Gradle: README.md uses ```gradle while CONTRIBUTING.md still
uses ```groovy; update the Gradle code blocks in CONTRIBUTING.md (the fences
around the gradle build snippets) to use the same ```gradle identifier so all
Gradle blocks are consistent across docs. Locate the Gradle examples by their
fenced blocks and replace the language tag from groovy to gradle for each Gradle
snippet.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| To get started, you first need to initialize the Meilisearch client. | ||
|
|
||
| ```java | ||
| package com.meilisearch.sdk; | ||
|
|
||
| import org.json.JSONArray; | ||
| import org.json.JSONObject; | ||
|
|
||
| import java.util.ArrayList; | ||
| import com.meilisearch.sdk.Client; | ||
| import com.meilisearch.sdk.Config; | ||
|
|
||
| class TestMeilisearch { | ||
| public static void main(String[] args) throws Exception { | ||
|
|
||
| JSONArray array = new JSONArray(); | ||
| ArrayList items = new ArrayList() {{ | ||
| add(new JSONObject().put("id", "1").put("title", "Carol").put("genres",new JSONArray("[\"Romance\",\"Drama\"]"))); | ||
| add(new JSONObject().put("id", "2").put("title", "Wonder Woman").put("genres",new JSONArray("[\"Action\",\"Adventure\"]"))); | ||
| add(new JSONObject().put("id", "3").put("title", "Life of Pi").put("genres",new JSONArray("[\"Adventure\",\"Drama\"]"))); | ||
| add(new JSONObject().put("id", "4").put("title", "Mad Max: Fury Road").put("genres",new JSONArray("[\"Adventure\",\"Science Fiction\"]"))); | ||
| add(new JSONObject().put("id", "5").put("title", "Moana").put("genres",new JSONArray("[\"Fantasy\",\"Action\"]"))); | ||
| add(new JSONObject().put("id", "6").put("title", "Philadelphia").put("genres",new JSONArray("[\"Drama\"]"))); | ||
| }}; | ||
|
|
||
| array.put(items); | ||
| String documents = array.getJSONArray(0).toString(); | ||
| Client client = new Client(new Config("http://localhost:7700", "masterKey")); | ||
|
|
||
| // An index is where the documents are stored. | ||
| Index index = client.index("movies"); | ||
|
|
||
| // If the index 'movies' does not exist, Meilisearch creates it when you first add the documents. | ||
| index.addDocuments(documents); // => { "taskUid": 0 } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| With the `taskUid`, you can check the status (`enqueued`, `canceled`, `processing`, `succeeded` or `failed`) of your documents addition using the [task endpoint](https://www.meilisearch.com/docs/reference/api/tasks). | ||
|
|
||
| #### Basic Search <!-- omit in toc --> | ||
|
|
||
| A basic search can be performed by calling `index.search()` method, with a simple string query. | ||
|
|
||
| ```java | ||
| import com.meilisearch.sdk.model.SearchResult; | ||
|
|
||
| // Meilisearch is typo-tolerant: | ||
| SearchResult results = index.search("carlo"); | ||
| System.out.println(results); | ||
| ``` | ||
|
|
||
| - Output: | ||
|
|
||
| ``` | ||
| SearchResult(hits=[{id=1.0, title=Carol, genres:[Romance, Drama]}], offset=0, limit=20, estimatedTotalHits=1, facetDistribution=null, processingTimeMs=3, query=carlo) | ||
| ``` | ||
|
|
||
| #### Custom Search <!-- omit in toc --> | ||
|
|
||
| If you want a custom search, the easiest way is to create a `SearchRequest` object, and set the parameters that you need.<br> | ||
| All the supported options are described in the [search parameters](https://www.meilisearch.com/docs/reference/api/search#search-parameters) section of the documentation. | ||
|
|
||
| ```java | ||
| import com.meilisearch.sdk.SearchRequest; | ||
|
|
||
| // ... | ||
|
|
||
| SearchResult results = (SearchResult) index.search( | ||
| new SearchRequest("of") | ||
| .setShowMatchesPosition(true) | ||
| .setAttributesToHighlight(new String[]{"title"}) | ||
| ); | ||
| System.out.println(results.getHits()); | ||
| ``` | ||
|
|
||
| - Output: | ||
|
|
||
| ```json | ||
| [{ | ||
| "id":3, | ||
| "title":"Life of Pi", | ||
| "genres":["Adventure","Drama"], | ||
| "_formatted":{ | ||
| "id":3, | ||
| "title":"Life <em>of</em> Pi", | ||
| "genres":["Adventure","Drama"] | ||
| }, | ||
| "_matchesPosition":{ | ||
| "title":[{ | ||
| "start":5.0, | ||
| "length":2.0 | ||
| }] | ||
| } | ||
| }] | ||
| ``` | ||
| #### Custom Search With Filters <!-- omit in toc --> | ||
|
|
||
| If you want to enable filtering, you must add your attributes to the `filterableAttributes` index setting. | ||
|
|
||
| ```java | ||
| index.updateFilterableAttributesSettings(new String[] | ||
| { | ||
| "id", | ||
| "genres" | ||
| }); | ||
| ``` | ||
|
|
||
| You only need to perform this operation once. | ||
|
|
||
| Note that Meilisearch will rebuild your index whenever you update `filterableAttributes`. Depending on the size of your dataset, this might take time. You can track the process using the [task status](https://www.meilisearch.com/docs/reference/api/tasks). | ||
|
|
||
| Then, you can perform the search: | ||
|
|
||
| ```java | ||
| index.search( | ||
| new SearchRequest("wonder") | ||
| .setFilter(new String[] {"id > 1 AND genres = Action"}) | ||
| ); | ||
| Client client = new Client(new Config("http://localhost:7700", "masterKey")); | ||
| ``` |
There was a problem hiding this comment.
Reconsider removing helpful Getting Started examples.
The Getting Started section has been reduced from comprehensive step-by-step examples to only client initialization. The removed content included practical examples of:
- Adding documents to an index
- Performing basic and custom searches
- Using filters and pagination
- Handling task UIDs
While simplification can improve readability, this change removes significant educational value. New users will now need to consult external documentation to understand basic SDK usage beyond initialization. Consider either:
- Restoring key examples (at minimum: adding a document and performing a basic search), or
- Adding a prominent link to a more detailed getting-started guide if one exists
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@README.md` around lines 74 - 81, The Getting Started section was trimmed to
only show Client/Config initialization (the Client and Config example), removing
practical usage examples (adding documents, basic searches, filters/pagination,
and task UID handling); restore at least two short examples: one showing how to
add a document to an index (create/get index, addDocuments or addDocumentsAsync
usage) and one showing a basic search call (search with query plus optional
filter and pagination params), placed immediately after the existing
Client/Config snippet, or alternatively add a prominent link labeled “Full
getting started guide” pointing to the more detailed external guide—ensure the
examples reference the same Client and index objects shown in the snippet and
include brief notes about handling task UIDs for async operations.
|
|
||
| **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](https://github.com/meilisearch/integration-guides) repository. | ||
| Contributions are welcome! If you want to contribute, please check our [contributing guide](CONTRIBUTING.md). | ||
| You can help by reporting bugs, suggesting new features, or submitting pull requests to improve the codebase and documentation. No newline at end of file |
There was a problem hiding this comment.
Add trailing newline at end of file.
The file ends without a trailing newline, which violates POSIX text file standards and common coding conventions. Adding a newline at the end of the file is a widely-adopted best practice that prevents issues with certain text processing tools and version control systems.
📝 Proposed fix
Contributions are welcome! If you want to contribute, please check our [contributing guide](CONTRIBUTING.md).
You can help by reporting bugs, suggesting new features, or submitting pull requests to improve the codebase and documentation.
+🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@README.md` at line 86, Add a single trailing newline at the end of README.md
so the last line ("You can help by reporting bugs, suggesting new features, or
submitting pull requests to improve the codebase and documentation.") is
terminated with a newline character; open README.md, move cursor to EOF after
that sentence, insert one newline, save the file to satisfy POSIX text file
conventions and avoid tooling/VCS issues.
Summary
This PR improves the README documentation for this project.
Changes: Improve documentation
This contribution was made as part of an open-source documentation improvement initiative. All changes are meant to be helpful additions to the project.
Summary by CodeRabbit