perf: add indexes and force their use (authors)

This commit is contained in:
Greg Heartsfield
2023-01-15 10:52:49 -06:00
parent 3e7f2e21df
commit fddbf321bc
2 changed files with 39 additions and 7 deletions
+13 -2
View File
@@ -524,8 +524,19 @@ fn override_index(f: &ReqFilter) -> Option<String> {
}
}
// if there is an author, it is much better to force the authors index.
if let Some(ks) = &f.authors {
return Some("author_index".into());
if let Some(_) = &f.authors {
if f.since.is_none() && f.until.is_none() {
if f.kinds.is_none() {
// with no use of kinds/created_at, just author
return Some("author_index".into());
} else {
// prefer author_kind if there are kinds
return Some("author_kind_index".into());
}
} else {
// finally, prefer author_created_at if time is provided
return Some("author_created_at_index".into());
}
}
None
}