use super::MatchArgs;
pub(crate) fn parse_match_score(argv: &[Vec<u8>]) -> Option<MatchArgs> {
let mut a = MatchArgs {
name: argv.get(1)?.clone(),
text: argv.get(2)?.clone(),
limit: std::str::from_utf8(argv.get(3)?).ok()?.strip_prefix("LIMIT=")?.parse().ok()?,
fields: Vec::new(),
highlight: None,
typo: 0,
offset: 0,
scope: Vec::new(),
filters: Vec::new(),
sort: None,
distinct: None,
facets: Vec::new(),
};
let mut i = 5;
while i < argv.len() {
i = super::apply_clause(argv, i, &mut a)?;
}
a.limit = a.limit.clamp(1, 1000);
a.offset = a.offset.min(10_000);
Some(a)
}