The drop down above the results is the department selector. Categories are the different groups of items in a scope's results, which is why you might have had trouble finding the correct API.
To add departments to your scope, you should call register_departments on the reply object in your query class's run method. This takes a unity::scopes::Department::SCPtr object representing the set of departments visible for this particular set of results:
if the user is currently browsing the top level department, you should pass a Department representing the top level, with its immediate children filled in.
If the user is browsing a sub-department, you should pass a Department representing the parent, with its immediate children filled in. The current department must appear within the children.
The idea is that only those parts of the department tree needed for immediate navigation are provided. Your code might look something like this:
Department::SPtr parent = Department::create("parent", query(), "Parent Dept")
parent->set_subdepartments({
Department::create("sibling", query(), "Sibling department"),
Department::create("current", query(), "Current departmnet")});
reply->register_departments(parent);
Now all you need to do is make your scope provide results relevant to the department selected by the user. This is made available in your query class as query().department_id(). This will match the ID of one of the departments you've previously registered, or "" which should be treated as the top level department.