@@ -126,7 +126,12 @@ public static DateProperty lastUpdatedAt() {
126126
127127 /** Filter by object property. */
128128 public static FilterBuilder property (String property ) {
129- return new FilterBuilder (new PathOperand (property ));
129+ return new FilterBuilder (new PathOperand (false , property ));
130+ }
131+
132+ /** Filter by object property's length. */
133+ public static FilterBuilder propertyLen (String property ) {
134+ return new FilterBuilder (new PathOperand (true , property ));
130135 }
131136
132137 public static class FilterBuilder {
@@ -616,22 +621,27 @@ static FilterOperand fromObject(Object value) {
616621
617622 private static class PathOperand implements FilterOperand {
618623 private final List <String > path ;
624+ private final boolean length ;
619625
620- private PathOperand (List <String > path ) {
626+ private PathOperand (boolean length , List <String > path ) {
621627 this .path = path ;
628+ this .length = length ;
622629 }
623630
624- private PathOperand (String ... path ) {
625- this (Arrays .asList (path ));
631+ private PathOperand (boolean length , String ... path ) {
632+ this (length , Arrays .asList (path ));
626633 }
627634
628635 @ Override
629636 public void appendTo (WeaviateProtoBase .Filters .Builder filter ) {
630637 if (!path .isEmpty ()) {
638+ var property = path .get (0 );
639+ if (length ) {
640+ property = "len(" + property + ")" ;
641+ }
631642 filter .setTarget (WeaviateProtoBase .FilterTarget .newBuilder ()
632- .setProperty (path . get ( 0 ) ));
643+ .setProperty (property ));
633644 }
634-
635645 // FIXME: no way to reference objects rn?
636646 }
637647
@@ -643,7 +653,7 @@ public String toString() {
643653
644654 public static class UuidProperty extends PathOperand {
645655 private UuidProperty () {
646- super (BaseQueryOptions .ID_PROPERTY );
656+ super (false , BaseQueryOptions .ID_PROPERTY );
647657 }
648658
649659 public Filter eq (String value ) {
@@ -681,7 +691,7 @@ public Filter containsNone(String... values) {
681691
682692 public static class DateProperty extends PathOperand {
683693 private DateProperty (String propertyName ) {
684- super (propertyName );
694+ super (false , propertyName );
685695 }
686696
687697 public Filter eq (OffsetDateTime value ) {
0 commit comments