def search_files(
    box_client: BoxClient,
    query: Optional[str] = None,
    scope: Optional[SearchForContentScope] = None,
    file_extensions: Optional[List[str]] = None,
    created_at_range: Optional[List[str]] = None,
    updated_at_range: Optional[List[str]] = None,
    size_range: Optional[List[int]] = None,
    owner_user_ids: Optional[List[str]] = None,
    recent_updater_user_ids: Optional[List[str]] = None,
    ancestor_folder_ids: Optional[List[str]] = None,
    content_types: Optional[List[SearchForContentContentTypes]] = None,
    limit: Optional[int] = None,
    offset: Optional[int] = None,
) -> List[File]:
    """
    Searches for files in Box based on a query string.

    Args:
        box_client (BoxClient): A Box client object.
        query (str): The search query string.

    Returns:
        List[File]: A list of Box file objects that match the search query.

    """
    # force to return only object type "file"
    type = SearchForContentType.FILE
    # return only the file id
    fields = ["id"]
    try:
        search_results: SearchResults = box_client.search.search_for_content(
            query=query,
            scope=scope,
            file_extensions=file_extensions,
            created_at_range=created_at_range,
            updated_at_range=updated_at_range,
            size_range=size_range,
            owner_user_ids=owner_user_ids,
            recent_updater_user_ids=recent_updater_user_ids,
            ancestor_folder_ids=ancestor_folder_ids,
            content_types=content_types,
            type=type,
            limit=limit,
            fields=fields,
            offset=offset,
        )
    except BoxAPIError as e:
        logger.error(f"An error occurred while searching for files: {e}", exc_info=True)
        return []

    return search_results.entries

    Searches for files in Box based on a query string.

    Args:
        box_client (BoxClient): A Box client object.
        query (str): The search query string.

    Returns:
        List[File]: A list of Box file objects that match the search query.

    
llama-index-integrations/readers/llama-index-readers-box/llama_index/readers/box/BoxAPI/box_api.py