Skip to content

Commit

Permalink
Trying to reproduce use case meilisearch/meilisearch-java#573
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoocasali committed May 9, 2023
1 parent 00b0bb4 commit 87bdc2b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion app/src/main/java/javapp/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package javapp;

import com.meilisearch.sdk.*;
import com.meilisearch.sdk.model.MatchingStrategy;

import org.json.JSONArray;
import org.json.JSONObject;
Expand Down Expand Up @@ -37,7 +38,15 @@ public static void main(String[] args) throws Exception {

Thread.sleep(1000);

System.out.println(client.index("movies").search("pi"));
SearchRequest searchRequest = new SearchRequest("w");
searchRequest.setFilter(new String[]{"mass < 200"});
searchRequest.setSort(new String[]{"mass:asc"});
searchRequest.setShowMatchesPosition(true);
searchRequest.setMatchingStrategy(MatchingStrategy.LAST);
searchRequest.setAttributesToHighlight(new String[]{"title", "description"});

System.out.println(searchRequest.toString());
System.out.println(client.index("movies").search(searchRequest));
} catch (Exception e) {
System.out.println(e);
}
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ volumes:

services:
package:
image: azul/zulu-openjdk:17-latest
image: azul/zulu-openjdk:11-latest
tty: true
stdin_open: true
working_dir: /home/package
Expand Down

0 comments on commit 87bdc2b

Please sign in to comment.