Skip to content

Commit 93825d9

Browse files
authored
Merge pull request #586 from weaviate/feat/blobHash
feat(config): add blobHash data type
2 parents 47d44db + 02076b5 commit 93825d9

3 files changed

Lines changed: 56 additions & 0 deletions

File tree

src/it/java/io/weaviate/integration/CollectionsITest.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.weaviate.integration;
22

33
import java.io.IOException;
4+
import java.util.ArrayList;
45

56
import org.assertj.core.api.Assertions;
67
import org.assertj.core.api.InstanceOfAssertFactories;
@@ -510,4 +511,39 @@ public void test_asyncReplicationConfig() throws IOException {
510511
.returns(13, AsyncReplicationConfig::propagationConcurrency)
511512
.returns(14, AsyncReplicationConfig::propagationBatchSize);
512513
}
514+
515+
@Test
516+
public void test_properties() {
517+
Assertions.assertThatCode(() -> {
518+
var properties = new ArrayList<Property>() {
519+
{
520+
add(Property.textArray("prop_textArray"));
521+
add(Property.integer("prop_integer"));
522+
add(Property.integerArray("prop_integerArray"));
523+
add(Property.number("prop_number"));
524+
add(Property.numberArray("prop_numberArray"));
525+
add(Property.bool("prop_bool"));
526+
add(Property.boolArray("prop_boolArray"));
527+
add(Property.blob("prop_blob"));
528+
add(Property.date("prop_date"));
529+
add(Property.dateArray("prop_dateArray"));
530+
add(Property.uuid("prop_uuid"));
531+
add(Property.uuidArray("prop_uuidArray"));
532+
add(Property.object("prop_object",
533+
p -> p.nestedProperties(Property.text("foo"))));
534+
add(Property.objectArray("prop_objectArray",
535+
p -> p.nestedProperties(Property.text("foo"))));
536+
add(Property.phoneNumber("prop_phoneNumber"));
537+
add(Property.geoCoordinates("prop_geoCoordinates"));
538+
}
539+
};
540+
541+
requireAtLeast(Weaviate.Version.V137, () -> {
542+
properties.add(Property.blobHash("prop_blobHash"));
543+
});
544+
545+
client.collections.create(
546+
ns("Things"), col -> col.properties(properties));
547+
}).doesNotThrowAnyException();
548+
}
513549
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public interface DataType {
1414
public static final String BOOL = "boolean";
1515
public static final String BOOL_ARRAY = "boolean[]";
1616
public static final String BLOB = "blob";
17+
public static final String BLOB_HASH = "blobHash";
1718
public static final String DATE = "date";
1819
public static final String DATE_ARRAY = "date[]";
1920
public static final String UUID = "uuid";

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,25 @@ public static Property blob(String name, Function<Builder, ObjectBuilder<Propert
118118
return newProperty(name, DataType.BLOB, fn);
119119
}
120120

121+
/**
122+
* Create a {@code blobHash} property.
123+
*
124+
* @param name Property name.
125+
*/
126+
public static Property blobHash(String name) {
127+
return blobHash(name, ObjectBuilder.identity());
128+
}
129+
130+
/**
131+
* Create a {@code blobHash} property with additional configuration.
132+
*
133+
* @param name Property name.
134+
* @param fn Lambda expression for optional parameters.
135+
*/
136+
public static Property blobHash(String name, Function<Builder, ObjectBuilder<Property>> fn) {
137+
return newProperty(name, DataType.BLOB_HASH, fn);
138+
}
139+
121140
/**
122141
* Create a {@code bool} property.
123142
*

0 commit comments

Comments
 (0)