Skip to content

Commit dc6ed18

Browse files
committed
Pull model changes.
1 parent 2654345 commit dc6ed18

File tree

6 files changed

+217
-8
lines changed

6 files changed

+217
-8
lines changed

src/main/java/org/typesense/api/MultiSearch.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.typesense.api;
22

33
import org.typesense.model.MultiSearchResponse;
4+
import org.typesense.model.MultiSearchSearchesParameter;
45

56
import java.util.Map;
67
import java.util.List;
@@ -14,7 +15,8 @@ public MultiSearch(ApiCall apiCall) {
1415
this.apiCall = apiCall;
1516
}
1617

17-
public MultiSearchResponse perform(Map<String , List<Map<String,String>>> multiSearchParameters, Map<String, String> common_params) throws Exception {
18+
public MultiSearchResponse perform(MultiSearchSearchesParameter multiSearchParameters,
19+
Map<String, String> common_params) throws Exception {
1820
return this.apiCall.post(MultiSearch.RESOURCEPATH, multiSearchParameters, common_params, MultiSearchResponse.class);
1921
}
2022
}

src/main/java/org/typesense/model/Field.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ public class Field {
3939
@Schema(example = "true", description = "")
4040
private Boolean infix = false;
4141

42+
@Schema(example = "256", description = "")
43+
private Integer numDim = null;
44+
4245
@Schema(example = "true", description = "")
4346
private Boolean drop = null;
4447
/**
@@ -185,6 +188,24 @@ public Field infix(Boolean infix) {
185188
return this;
186189
}
187190

191+
/**
192+
* Get numDim
193+
* @return numDim
194+
**/
195+
@JsonProperty("num_dim")
196+
public Integer getNumDim() {
197+
return numDim;
198+
}
199+
200+
public void setNumDim(Integer numDim) {
201+
this.numDim = numDim;
202+
}
203+
204+
public Field numDim(Integer numDim) {
205+
this.numDim = numDim;
206+
return this;
207+
}
208+
188209
/**
189210
* Get drop
190211
* @return drop
@@ -217,6 +238,7 @@ public String toString() {
217238
sb.append(" locale: ").append(toIndentedString(locale)).append("\n");
218239
sb.append(" sort: ").append(toIndentedString(sort)).append("\n");
219240
sb.append(" infix: ").append(toIndentedString(infix)).append("\n");
241+
sb.append(" numDim: ").append(toIndentedString(numDim)).append("\n");
220242
sb.append(" drop: ").append(toIndentedString(drop)).append("\n");
221243
sb.append("}");
222244
return sb.toString();

src/main/java/org/typesense/model/MultiSearchParameters.java

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public class MultiSearchParameters {
9696
/**
9797
* The number of typographical errors (1 or 2) that would be tolerated. Default: 2
9898
**/
99-
private Integer numTypos = null;
99+
private String numTypos = null;
100100

101101
@Schema(description = "Results from this specific page number would be fetched.")
102102
/**
@@ -247,6 +247,12 @@ public class MultiSearchParameters {
247247
* Minimum word length for 2-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos.
248248
**/
249249
private Integer minLen2typo = null;
250+
251+
@Schema(description = "Vector query expression for fetching documents \"closest\" to a given query/document vector. ")
252+
/**
253+
* Vector query expression for fetching documents \"closest\" to a given query/document vector.
254+
**/
255+
private String vectorQuery = null;
250256
/**
251257
* The query text to search for in the collection. Use * as the search string to return all documents. This is typically useful when used in conjunction with filter_by.
252258
* @return q
@@ -468,15 +474,15 @@ public MultiSearchParameters facetQuery(String facetQuery) {
468474
* @return numTypos
469475
**/
470476
@JsonProperty("num_typos")
471-
public Integer getNumTypos() {
477+
public String getNumTypos() {
472478
return numTypos;
473479
}
474480

475-
public void setNumTypos(Integer numTypos) {
481+
public void setNumTypos(String numTypos) {
476482
this.numTypos = numTypos;
477483
}
478484

479-
public MultiSearchParameters numTypos(Integer numTypos) {
485+
public MultiSearchParameters numTypos(String numTypos) {
480486
this.numTypos = numTypos;
481487
return this;
482488
}
@@ -931,6 +937,24 @@ public MultiSearchParameters minLen2typo(Integer minLen2typo) {
931937
return this;
932938
}
933939

940+
/**
941+
* Vector query expression for fetching documents \&quot;closest\&quot; to a given query/document vector.
942+
* @return vectorQuery
943+
**/
944+
@JsonProperty("vector_query")
945+
public String getVectorQuery() {
946+
return vectorQuery;
947+
}
948+
949+
public void setVectorQuery(String vectorQuery) {
950+
this.vectorQuery = vectorQuery;
951+
}
952+
953+
public MultiSearchParameters vectorQuery(String vectorQuery) {
954+
this.vectorQuery = vectorQuery;
955+
return this;
956+
}
957+
934958

935959
@Override
936960
public String toString() {
@@ -975,6 +999,7 @@ public String toString() {
975999
sb.append(" cacheTtl: ").append(toIndentedString(cacheTtl)).append("\n");
9761000
sb.append(" minLen1typo: ").append(toIndentedString(minLen1typo)).append("\n");
9771001
sb.append(" minLen2typo: ").append(toIndentedString(minLen2typo)).append("\n");
1002+
sb.append(" vectorQuery: ").append(toIndentedString(vectorQuery)).append("\n");
9781003
sb.append("}");
9791004
return sb.toString();
9801005
}

src/main/java/org/typesense/model/SearchHighlight.java

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ public class SearchHighlight {
3232
**/
3333
private List<String> snippets = null;
3434

35+
@Schema(example = "<mark>Stark</mark> Industries is a major supplier of space equipment.", description = "Full field value with highlighting, present only for (non-array) string fields")
36+
/**
37+
* Full field value with highlighting, present only for (non-array) string fields
38+
**/
39+
private String value = null;
40+
41+
@Schema(example = "[\"<mark>Stark</mark> Industries\",\"<mark>Stark</mark> Corp\"]", description = "Full field value with highlighting, present only for (array) string[] fields")
42+
/**
43+
* Full field value with highlighting, present only for (array) string[] fields
44+
**/
45+
private List<String> values = null;
46+
3547
@Schema(example = "1", description = "The indices property will be present only for string[] fields and will contain the corresponding indices of the snippets in the search field")
3648
/**
3749
* The indices property will be present only for string[] fields and will contain the corresponding indices of the snippets in the search field
@@ -99,6 +111,47 @@ public SearchHighlight addSnippetsItem(String snippetsItem) {
99111
return this;
100112
}
101113

114+
/**
115+
* Full field value with highlighting, present only for (non-array) string fields
116+
* @return value
117+
**/
118+
@JsonProperty("value")
119+
public String getValue() {
120+
return value;
121+
}
122+
123+
public void setValue(String value) {
124+
this.value = value;
125+
}
126+
127+
public SearchHighlight value(String value) {
128+
this.value = value;
129+
return this;
130+
}
131+
132+
/**
133+
* Full field value with highlighting, present only for (array) string[] fields
134+
* @return values
135+
**/
136+
@JsonProperty("values")
137+
public List<String> getValues() {
138+
return values;
139+
}
140+
141+
public void setValues(List<String> values) {
142+
this.values = values;
143+
}
144+
145+
public SearchHighlight values(List<String> values) {
146+
this.values = values;
147+
return this;
148+
}
149+
150+
public SearchHighlight addValuesItem(String valuesItem) {
151+
this.values.add(valuesItem);
152+
return this;
153+
}
154+
102155
/**
103156
* The indices property will be present only for string[] fields and will contain the corresponding indices of the snippets in the search field
104157
* @return indices
@@ -154,6 +207,8 @@ public String toString() {
154207
sb.append(" field: ").append(toIndentedString(field)).append("\n");
155208
sb.append(" snippet: ").append(toIndentedString(snippet)).append("\n");
156209
sb.append(" snippets: ").append(toIndentedString(snippets)).append("\n");
210+
sb.append(" value: ").append(toIndentedString(value)).append("\n");
211+
sb.append(" values: ").append(toIndentedString(values)).append("\n");
157212
sb.append(" indices: ").append(toIndentedString(indices)).append("\n");
158213
sb.append(" matchedTokens: ").append(toIndentedString(matchedTokens)).append("\n");
159214
sb.append("}");

src/main/java/org/typesense/model/SearchParameters.java

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ public class SearchParameters {
153153
**/
154154
private String highlightEndTag = null;
155155

156+
@Schema(description = "Flag for enabling/disabling the deprecated, old highlight structure in the response. Default: true ")
157+
/**
158+
* Flag for enabling/disabling the deprecated, old highlight structure in the response. Default: true
159+
**/
160+
private Boolean enableHighlightV1 = true;
161+
156162
@Schema(description = "Field values under this length will be fully highlighted, instead of showing a snippet of relevant portion. Default: 30 ")
157163
/**
158164
* Field values under this length will be fully highlighted, instead of showing a snippet of relevant portion. Default: 30
@@ -260,6 +266,12 @@ public class SearchParameters {
260266
* Minimum word length for 2-typo correction to be applied. The value of num_typos is still treated as the maximum allowed typos.
261267
**/
262268
private Integer minLen2typo = null;
269+
270+
@Schema(description = "Vector query expression for fetching documents \"closest\" to a given query/document vector. ")
271+
/**
272+
* Vector query expression for fetching documents \"closest\" to a given query/document vector.
273+
**/
274+
private String vectorQuery = null;
263275
/**
264276
* The query text to search for in the collection. Use * as the search string to return all documents. This is typically useful when used in conjunction with filter_by.
265277
* @return q
@@ -674,6 +686,24 @@ public SearchParameters highlightEndTag(String highlightEndTag) {
674686
return this;
675687
}
676688

689+
/**
690+
* Flag for enabling/disabling the deprecated, old highlight structure in the response. Default: true
691+
* @return enableHighlightV1
692+
**/
693+
@JsonProperty("enable_highlight_v1")
694+
public Boolean isEnableHighlightV1() {
695+
return enableHighlightV1;
696+
}
697+
698+
public void setEnableHighlightV1(Boolean enableHighlightV1) {
699+
this.enableHighlightV1 = enableHighlightV1;
700+
}
701+
702+
public SearchParameters enableHighlightV1(Boolean enableHighlightV1) {
703+
this.enableHighlightV1 = enableHighlightV1;
704+
return this;
705+
}
706+
677707
/**
678708
* Field values under this length will be fully highlighted, instead of showing a snippet of relevant portion. Default: 30
679709
* @return snippetThreshold
@@ -998,6 +1028,24 @@ public SearchParameters minLen2typo(Integer minLen2typo) {
9981028
return this;
9991029
}
10001030

1031+
/**
1032+
* Vector query expression for fetching documents \&quot;closest\&quot; to a given query/document vector.
1033+
* @return vectorQuery
1034+
**/
1035+
@JsonProperty("vector_query")
1036+
public String getVectorQuery() {
1037+
return vectorQuery;
1038+
}
1039+
1040+
public void setVectorQuery(String vectorQuery) {
1041+
this.vectorQuery = vectorQuery;
1042+
}
1043+
1044+
public SearchParameters vectorQuery(String vectorQuery) {
1045+
this.vectorQuery = vectorQuery;
1046+
return this;
1047+
}
1048+
10011049

10021050
@Override
10031051
public String toString() {
@@ -1027,6 +1075,7 @@ public String toString() {
10271075
sb.append(" highlightAffixNumTokens: ").append(toIndentedString(highlightAffixNumTokens)).append("\n");
10281076
sb.append(" highlightStartTag: ").append(toIndentedString(highlightStartTag)).append("\n");
10291077
sb.append(" highlightEndTag: ").append(toIndentedString(highlightEndTag)).append("\n");
1078+
sb.append(" enableHighlightV1: ").append(toIndentedString(enableHighlightV1)).append("\n");
10301079
sb.append(" snippetThreshold: ").append(toIndentedString(snippetThreshold)).append("\n");
10311080
sb.append(" dropTokensThreshold: ").append(toIndentedString(dropTokensThreshold)).append("\n");
10321081
sb.append(" typoTokensThreshold: ").append(toIndentedString(typoTokensThreshold)).append("\n");
@@ -1045,6 +1094,7 @@ public String toString() {
10451094
sb.append(" cacheTtl: ").append(toIndentedString(cacheTtl)).append("\n");
10461095
sb.append(" minLen1typo: ").append(toIndentedString(minLen1typo)).append("\n");
10471096
sb.append(" minLen2typo: ").append(toIndentedString(minLen2typo)).append("\n");
1097+
sb.append(" vectorQuery: ").append(toIndentedString(vectorQuery)).append("\n");
10481098
sb.append("}");
10491099
return sb.toString();
10501100
}

0 commit comments

Comments
 (0)