4
4
5
5
Manticore Search Client
6
6
7
- - API version: 5 .0.0
7
+ - API version: 6 .0.0
8
8
9
- - Build date: 2024-10-28T07:04:51.268969530Z [ Etc/UTC]
9
+ - Build date: 2024-10-28T12:56:08.804080940Z [ Etc/UTC]
10
10
11
11
Сlient for Manticore Search.
12
12
@@ -20,6 +20,7 @@ Building the API client library requires:
20
20
21
21
| Manticore Search | manticoresearch-java |
22
22
| ----------------- | ----------------------- |
23
+ | dev | dev |
23
24
| >= 6.3.6 | >= 5.0.x |
24
25
| >= 6.2.0 | >= 3.3.1 |
25
26
| >= 2.5.1 | >= 2.0.2 |
@@ -48,7 +49,7 @@ Add this dependency to your project's POM:
48
49
<dependency >
49
50
<groupId >com.manticoresearch</groupId >
50
51
<artifactId >manticoresearch</artifactId >
51
- <version >5 .0.0</version >
52
+ <version >6 .0.0</version >
52
53
<scope >compile</scope >
53
54
</dependency >
54
55
```
@@ -64,7 +65,7 @@ Add this dependency to your project's build file:
64
65
}
65
66
66
67
dependencies {
67
- implementation "com.manticoresearch:manticoresearch:5 .0.0"
68
+ implementation "com.manticoresearch:manticoresearch:6 .0.0"
68
69
}
69
70
```
70
71
@@ -78,7 +79,7 @@ mvn clean package
78
79
79
80
Then manually install the following JARs:
80
81
81
- - ` target/manticoresearch-5 .0.0.jar `
82
+ - ` target/manticoresearch-6 .0.0.jar `
82
83
- ` target/lib/*.jar `
83
84
84
85
## Getting Started
@@ -100,34 +101,33 @@ public class ApiExample {
100
101
101
102
IndexApi apiInstance = new IndexApi (defaultClient);
102
103
String body = " body_example" ; // String |
103
- try {
104
- BulkResponse result = apiInstance. bulk(body);
105
- System . out. println(result);
106
- } catch (ApiException e) {
107
- System . err. println(" Exception when calling IndexApi#bulk" );
108
- System . err. println(" Status code: " + e. getCode());
109
- System . err. println(" Reason: " + e. getResponseBody());
110
- System . err. println(" Response headers: " + e. getResponseHeaders());
111
- e. printStackTrace();
112
- }
113
-
104
+
105
+ # Perform insert and search operations
114
106
SearchApi searchApi = new SearchApi (client);
107
+ IndexApi indexApi = new IndexApi (client);
115
108
try {
116
- // Create SearchRequest
117
- BasicSearchRequest basicSearchRequest = new BasicSearchRequest ();
118
- basicSearchRequest. setIndex(" test" );
109
+ String tableName = " products" ;
110
+
111
+ InsertDocumentRequest indexRequest = new InsertDocumentRequest ();
112
+ HashMap<String ,Object > doc = new HashMap<String ,Object > ();
113
+ indexRequest. index(tableName). id(1L ). setDoc(doc);
114
+ indexApi. insert(indexRequest);
115
+
116
+ Highlight highlight = new Highlight ();
117
+ List<String > highlightFields = new ArrayList<String > ();
118
+ highlightFields. add(" title" );
119
+ highlight. setFields(highlightFields);
119
120
120
- QueryStringFilter queryStringFilter = new QueryStringFilter ();
121
- queryStringFilter. setQueryString(" Title 1" );
122
- basicSearchRequest. setQuery(new QueryFilter ( new FulltextFilter (queryStringFilter) ));
121
+ SearchQuery query = new SearchQuery ();
122
+ query. setQueryString(" @title Bag" );
123
123
124
- SearchRequest searchRequest = new SearchRequest (basicSearchRequest );
125
-
126
- // Perform a search
124
+ SearchRequest searchRequest = new SearchRequest ();
125
+ searchRequest . index(tableName) . query(query) . setHighlight(highlight);
126
+
127
127
SearchResponse searchResponse = searchApi. search(searchRequest);
128
- System . out. println( searchResponse. toString() );
128
+ System . out. println(searchResponse);
129
129
} catch (ApiException e) {
130
- System . err. println(" Exception when calling SearchApi#search " );
130
+ System . err. println(" Exception when calling Api function " );
131
131
System . err. println(" Status code: " + e. getCode());
132
132
System . err. println(" Reason: " + e. getResponseBody());
133
133
System . err. println(" Response headers: " + e. getResponseHeaders());
0 commit comments