Skip to content

Incorrent result when query using lessThan or lessOrEqual for a String field with @Index(type: IndexType.value) #318

@lokingwei

Description

@lokingwei

When create a IndexType.value for a string field, and query using lessOrEqual and lessThan with the value larger than then last record, eg \uffff, the query return zero record instead of all record

reproduce repo: https://github.com/lokingwei/objectbox_string_lessthan

@Entity()
class Doc {
  int? id;

  @Index(type: IndexType.value)
  String key;
  Doc({
    required this.key,
  });
}

box.put(Doc(key: 'b'));
box.put(Doc(key: 'c'));
box.put(Doc(key: 'd'));

// this line is corrent
expect(box.query(Doc_.key.lessOrEqual('d')).build().find(), hasLength(3));
// expected result to be 3 but return 0
expect(box.query(Doc_.key.lessOrEqual('e')).build().find(), hasLength(3));

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions