Extension: omni.kit.search_example-1.0.3

Documentation Generated: Nov 13, 2025

Overview#

The omni.kit.search_example extension demonstrates how to implement custom search functionality by creating and registering a search model with the search system. This extension provides a practical example of integrating file system search capabilities into applications through the omni.kit.search_core framework.

_images/preview.png

Concepts#

The extension introduces two core concepts for building search functionality:

Search Model: The SearchModel class implements file system search by filtering directory contents based on text matching. It performs asynchronous directory listing operations and maintains a collection of search results.

Search Items: The SearchItem class represents individual search results, encapsulating file or folder information including path, name, modification date, size, and type properties.

Functionality#

The extension provides directory-based file searching with text filtering capabilities. When activated, it registers an example search model that can locate files and folders within a specified directory based on name matching.

The search operates asynchronously to avoid blocking the user interface during directory traversal. Results include both files and folders, with each item providing metadata such as size, modification date, and folder status.

Current limitations: The search implementation does not support recursive directory traversal, limiting results to the immediate contents of the specified directory.

Usage Examples#

The extension automatically registers its search model upon startup, making it available through the search system:

from omni.kit.search_example import SearchModel, SearchItem

# Create a search model for the current directory
search_model = SearchModel(
    search_text="example",
    current_dir="/path/to/directory"
)

# Access search results
for item in search_model.items:
    print(f"Found: {item.name} at {item.path}")
    print(f"Size: {item.size} bytes, Modified: {item.date}")
    print(f"Is folder: {item.is_folder}")

Relationships#

The extension builds upon omni.kit.search_core, which provides the AbstractSearchModel and AbstractSearchItem base classes. It uses omni.client for file system operations and directory listing functionality.