-
Notifications
You must be signed in to change notification settings - Fork 132
parent_prefix
parent_prefix is a parameter to the search_prefix function. It's a bit weird and you typically don't need to use it. the only thing using it today is the fancy web GUI.
The need arises from when expanding a collapsed prefix. If the children of the collapsed prefix was included in the result of a normal search, it means we already have the children and that they are correctly marked as matching or not. If on the other hand, this is just a parent prefix of a matching prefix, we will not have all the children of this parent prefix and need to fetch them from the backend. That was initially performed with a list_prefix, and although the list_prefix did return all children of the parent, it did not mark them as matches or not. Most of the time, this wouldn't be an issue as the prefix would have been included in the initial result set, but if the matching prefix is too "far down" the result, it wouldn't have been included.
parent_prefix solves this by letting the search_prefix emulate the output of list_prefix, ie not a full tree but only return a single level of prefixes and mark prefixes as matches or non-matches based on the regular dict-SQL.