clause method
Implementation
Query clause(Clause clause) {
clause.fields ??= allFields;
clause.boost ??= 1;
clause.usePipeline ??= true;
clause.wildcard ??= Query_wildcard_NONE;
clause.presence ??= QueryPresence.OPTIONAL;
bool leadingBit =
clause.wildcard! & Query_wildcard_LEADING == Query_wildcard_LEADING;
if (leadingBit && (clause.term[0] != Query_wildcard)) {
clause.term = "*${clause.term}";
}
bool trailingBit =
clause.wildcard! & Query_wildcard_TRAILING == Query_wildcard_TRAILING;
if (trailingBit &&
(clause.term[clause.term.length - 1] != Query_wildcard)) {
clause.term = "${clause.term}*";
}
clauses.add(clause);
return this;
}