SearchResultsModel#

class omni.kit.window.filepicker.SearchResultsModel(
search_model: AbstractSearchModel,
**kwargs,
)#

Bases: FileBrowserModel

Class representing the search results model.

This class extends FileBrowserModel to display and manage search results obtained from a search model. It creates a root group item labeled ‘Search Results’ and subscribes to changes provided by the search model. The subscription ensures that any updates in the search items are reflected in the file browser view.

The destroy method removes the subscription and cleans up the search model to prevent circular dependencies. The get_item_children method retrieves the children items from the root group. If a filter function is set, it applies the filter to the list of children before returning them.

Parameters:

search_model (AbstractSearchModel) – The instance that provides search items and controls the search logic.

Methods

__init__(search_model, **kwargs)

Initializes a SearchResultsModel with a search model and optional keyword arguments.

destroy()

Destroys the SearchResultsModel instance by removing subscriptions and releasing resources.

get_item_children(item)

Retrieves child items from the search results.

Attributes

__init__(
search_model: AbstractSearchModel,
**kwargs,
)#

Initializes a SearchResultsModel with a search model and optional keyword arguments. Sets up the root group and subscribes to item changes.

destroy()#

Destroys the SearchResultsModel instance by removing subscriptions and releasing resources.

get_item_children(
item: SearchResultsItem,
) [<class 'omni.kit.widget.search_delegate.model.SearchResultsItem'>]#

Retrieves child items from the search results. If the root group is not populated, it creates children from the search model and then applies optional filtering.

Parameters:

item (SearchResultsItem) – The search item to retrieve children for.

Returns:

List of child items associated with the provided search item.

Return type:

List[SearchResultsItem]