Skip to content

Commit b8766f1

Browse files
committed
feat: support per-property tokenization config
1 parent d215a66 commit b8766f1

3 files changed

Lines changed: 34 additions & 0 deletions

File tree

src/main/java/io/weaviate/client6/v1/api/collections/Property.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public record Property(
1616
@SerializedName("indexFilterable") Boolean indexFilterable,
1717
@SerializedName("indexRangeFilters") Boolean indexRangeFilters,
1818
@SerializedName("indexSearchable") Boolean indexSearchable,
19+
@SerializedName("tokenization") Tokenization tokenization,
1920
@SerializedName("skipVectorization") Boolean skipVectorization,
2021
@SerializedName("vectorizePropertyName") Boolean vectorizePropertyName) {
2122

@@ -142,6 +143,7 @@ public Builder edit() {
142143
.indexFilterable(indexFilterable)
143144
.indexRangeFilters(indexRangeFilters)
144145
.indexSearchable(indexSearchable)
146+
.tokenization(tokenization)
145147
.skipVectorization(skipVectorization)
146148
.vectorizePropertyName(vectorizePropertyName);
147149
}
@@ -159,6 +161,7 @@ public Property(Builder builder) {
159161
builder.indexFilterable,
160162
builder.indexRangeFilters,
161163
builder.indexSearchable,
164+
builder.tokenization,
162165
builder.skipVectorization,
163166
builder.vectorizePropertyName);
164167
}
@@ -174,6 +177,7 @@ public static class Builder implements ObjectBuilder<Property> {
174177
private Boolean indexFilterable;
175178
private Boolean indexRangeFilters;
176179
private Boolean indexSearchable;
180+
private Tokenization tokenization;
177181
private Boolean skipVectorization;
178182
private Boolean vectorizePropertyName;
179183

@@ -221,6 +225,11 @@ public Builder indexSearchable(Boolean indexSearchable) {
221225
return this;
222226
}
223227

228+
public Builder tokenization(Tokenization tokenization) {
229+
this.tokenization = tokenization;
230+
return this;
231+
}
232+
224233
public Builder skipVectorization(Boolean skipVectorization) {
225234
this.skipVectorization = skipVectorization;
226235
return this;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package io.weaviate.client6.v1.api.collections;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
5+
public enum Tokenization {
6+
@SerializedName("word")
7+
WORD,
8+
@SerializedName("whitespace")
9+
WHITESPACE,
10+
@SerializedName("lowercase")
11+
LOWERCASE,
12+
@SerializedName("field")
13+
FIELD,
14+
@SerializedName("gse")
15+
GSE,
16+
@SerializedName("trigram")
17+
TRIGRAM,
18+
@SerializedName("kagome_ja")
19+
KAGOME_JA,
20+
@SerializedName("kagome_kr")
21+
KAGOME_KR;
22+
}

src/test/java/io/weaviate/client6/v1/internal/json/JSONTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import io.weaviate.client6.v1.api.collections.ObjectMetadata;
2020
import io.weaviate.client6.v1.api.collections.Property;
2121
import io.weaviate.client6.v1.api.collections.Reranker;
22+
import io.weaviate.client6.v1.api.collections.Tokenization;
2223
import io.weaviate.client6.v1.api.collections.Vectorizer;
2324
import io.weaviate.client6.v1.api.collections.Vectorizers;
2425
import io.weaviate.client6.v1.api.collections.Vectors;
@@ -224,6 +225,7 @@ public static Object[][] testCases() {
224225
.description("A collection of things")
225226
.properties(
226227
Property.text("shape"),
228+
Property.text("custom_id", p -> p.tokenization(Tokenization.WORD)),
227229
Property.integer("size"))
228230
.references(
229231
Property.reference("owner", "Person", "Company"))
@@ -237,6 +239,7 @@ public static Object[][] testCases() {
237239
"properties": [
238240
{"name": "shape", "dataType": ["text"]},
239241
{"name": "size", "dataType": ["int"]},
242+
{"name": "custom_id", "dataType": ["text"], tokenization: "word"},
240243
{"name": "owner", "dataType": ["Person", "Company"]}
241244
],
242245
"vectorConfig": {

0 commit comments

Comments
 (0)