.fieldEntry()
.use(fieldType)
.add()
.create();
Record record =
repository.recordBuilder().recordType(rt.getName()).field(fieldType.getName(), "value1").create();
repository.recordBuilder().recordType(rt.getName()).field(fieldType.getName(), "value1").create();
repository.recordBuilder().recordType(rt.getName()).field(fieldType.getName(), "value2").create();
repository.recordBuilder().recordType(rt.getName()).field(fieldType.getName(), "value2").create();
repository.recordBuilder().recordType(rt.getName()).field(fieldType.getName(), "value2").create();
RecordScan scan = new RecordScan();
scan.setRecordFilter(new FieldValueFilter(fieldType.getName(), "value1"));
assertEquals(2, countResults(repository.getScanner(scan)));
scan = new RecordScan();
scan.setRecordFilter(new FieldValueFilter(fieldType.getName(), "value2"));
assertEquals(3, countResults(repository.getScanner(scan)));
scan = new RecordScan();
scan.setRecordFilter(new FieldValueFilter(fieldType.getName(), CompareOp.NOT_EQUAL, "value1"));
assertEquals(3, countResults(repository.getScanner(scan)));
// (At the time of this writing, ...) when non-versioned fields are deleted, a delete marker is
// written rather than really deleting the field. This delete marker would then also be 'not equal'
// to the value we search, and we'd get an extra result. This test verifies the implementation takes
// care of that.
record.getFieldsToDelete().add(fieldType.getName());
record.setField(fieldType1.getName(), "whatever");
record = repository.update(record);
scan = new RecordScan();
scan.setRecordFilter(new FieldValueFilter(fieldType.getName(), CompareOp.NOT_EQUAL, "value1"));
assertEquals(3, countResults(repository.getScanner(scan)));