Add backend filter for field name
This commit is contained in:
parent
a930aa41f0
commit
d33442f901
@ -505,6 +505,7 @@ class Collection:
|
||||
added_in: Optional[int] = None,
|
||||
due_in: Optional[int] = None,
|
||||
nids: Optional[List[int]] = None,
|
||||
field_name: Optional[str] = None,
|
||||
) -> str:
|
||||
filters = searches or []
|
||||
|
||||
@ -532,6 +533,8 @@ class Collection:
|
||||
append_filter(FilterToSearchIn(due_in=due_in))
|
||||
if nids:
|
||||
append_filter(FilterToSearchIn(nids=NoteIDs(nids=nids)))
|
||||
if field_name:
|
||||
append_filter(FilterToSearchIn(field_name=field_name))
|
||||
if concat_by_or:
|
||||
sep = ConcatSeparator.OR
|
||||
else:
|
||||
|
@ -802,6 +802,7 @@ message FilterToSearchIn {
|
||||
// will be due in the next x days
|
||||
int32 due_in = 9;
|
||||
NoteIDs nids = 10;
|
||||
string field_name = 11;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -351,6 +351,11 @@ impl From<pb::FilterToSearchIn> for Node<'_> {
|
||||
kind: PropertyKind::Due(i),
|
||||
}),
|
||||
Filter::Nids(nids) => Node::Search(SearchNode::NoteIDs(nids.into_id_string().into())),
|
||||
Filter::FieldName(s) => Node::Search(SearchNode::SingleField {
|
||||
field: escape_anki_wildcards(&s).into_owned().into(),
|
||||
text: "*".to_string().into(),
|
||||
is_re: false,
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user