Conversation
📝 WalkthroughWalkthroughThe README.md has been substantially simplified, reducing documentation from 236 to 6 lines. Changes include updating the Gradle syntax highlighting, removing the okhttp peer-dependency warning, condensing the getting started section into a single initialization example, and removing customization, learning resources, and detailed contribution guidance sections. 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: 1
🤖 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 75-82: The PR removed essential "Getting started" content from
README (leaving only the Client initialization example), breaking onboarding;
restore the removed sections or explicitly link to their new locations: re-add
examples for adding documents and performing searches (including filters, custom
queries, and pagination), the "Customization" section describing JSON handler
configuration, the "Learn more" guide links, and the detailed contribution
guidelines, or if moved to other files/dirs, update the README's Getting started
section to point to those exact docs; use the existing client initialization
snippet (Client/Config) as the lead-in and ensure the README clearly shows how
to go from instantiating the client to indexing and searching so new users can
follow end-to-end.
🪄 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.
Critical documentation removal contradicts PR objective.
This PR claims to "improve documentation" but actually removes essential content that enables developers to use the library. The "Getting started" section has been reduced to only client initialization, removing:
- How to add documents (core functionality)
- How to perform searches (primary use case)
- Search examples with filters, custom queries, and pagination
- The entire "Customization" section (JSON handler configuration)
- The "Learn more" section with links to guides
- Detailed contribution guidelines
This massive reduction (236 to 6 lines per the summary) severely degrades the developer experience for new users who need working examples to get started. The README should help users quickly understand how to use the library, not just how to instantiate a client.
Please clarify the reasoning for removing this critical documentation. If the intent is to move content elsewhere, that should be clearly communicated with appropriate links.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@README.md` around lines 75 - 82, The PR removed essential "Getting started"
content from README (leaving only the Client initialization example), breaking
onboarding; restore the removed sections or explicitly link to their new
locations: re-add examples for adding documents and performing searches
(including filters, custom queries, and pagination), the "Customization" section
describing JSON handler configuration, the "Learn more" guide links, and the
detailed contribution guidelines, or if moved to other files/dirs, update the
README's Getting started section to point to those exact docs; use the existing
client initialization snippet (Client/Config) as the lead-in and ensure the
README clearly shows how to go from instantiating the client to indexing and
searching so new users can follow end-to-end.
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