// TODO: if field is a Ref<>, you can thoretically use findBackRefs
static A nuLike findConceptWhere(Class c, O... params) {
ret findConceptWhere(db_mainConcepts(), c, params);
}
static A findConceptWhere(Concepts concepts, Class c, O... params) {
ping();
params = expandParams(c, params);
// indexed
if (concepts.fieldIndices != null)
for (int i = 0; i < l(params); i += 2) {
IFieldIndex index = concepts.getFieldIndex(c, (S) params[i]);
if (index != null) {
for (A x : index.getAll(params[i+1]))
if (checkConceptFields(x, params)) ret x;
null;
}
}
// table scan
for (A x : concepts.list(c)) if (checkConceptFields(x, params)) ret x;
null;
}
static Concept findConceptWhere(Concepts concepts, S c, O... params) {
for (Concept x : concepts.list(c)) if (checkConceptFields(x, params)) ret x;
null;
}