SearchModule

public class SearchModule

Provides functionality to search for content.

  • Searches for items in Box.

    Declaration

    Swift

    public func query(
        query: String?,
        scope: SearchScope? = nil,
        fileExtensions: [String]? = nil,
        createdAfter: Date? = nil,
        createdBefore: Date? = nil,
        updatedAfter: Date? = nil,
        updatedBefore: Date? = nil,
        sizeAtLeast: Int64? = nil,
        sizeAtMost: Int64? = nil,
        ownerUserIDs: [String]? = nil,
        ancestorFolderIDs: [String]? = nil,
        searchIn: [SearchContentType]? = nil,
        itemType: SearchItemType? = nil,
        searchTrash: Bool? = nil,
        metadataFilter: MetadataSearchFilter? = nil,
        fields: [String]? = nil,
        offset: Int? = nil,
        limit: Int? = nil
    ) -> PagingIterator<FolderItem>

    Parameters

    query

    The text to serach for.

    scope

    The scope of content to search within; admins can serach within their entire enterprise.

    fileExtensions

    Limit the search to files with the given extensions.

    createdAfter

    Limit the search to items created after this date.

    createdBefore

    Limit the search to items created before this date.

    updatedAfter

    Limit the search to items updated after this date.

    updatedBefore

    Limit the search to items updated before this date.

    sizeAtLeast

    Limit the search to items at least this size, in bytes.

    sizeAtMost

    Limit the search to items at most this size, in bytes

    ownerUserIDs

    Limit the search to only items owned by one of the specified users.

    ancestorFolderIDs

    Limit the search to items within the specified folders. This includes all content under these folders, not just their immediate children.

    searchIn

    Specifies the areas where the search should look for the query string.

    itemType

    Limits the search to only items of the given type.

    searchTrash

    Whether to search in the trash. The options are mutually exclusive; either

    metadataFilter

    The metadata template filters to limit the search results to. only trashed content or non-trashed content will be searched.

    offset

    The offset within the collection of results to start from.

    limit

    The limit for how many search results will be returned.

    completion

    Called with the results of the search query, or an error if the request is unsuccessful.

  • Searches for items in Box, including items that a user might have accessed recently through a shared link.

    Declaration

    Swift

    public func queryWithSharedLinks(
        query: String?,
        scope: SearchScope? = nil,
        fileExtensions: [String]? = nil,
        createdAfter: Date? = nil,
        createdBefore: Date? = nil,
        updatedAfter: Date? = nil,
        updatedBefore: Date? = nil,
        sizeAtLeast: Int64? = nil,
        sizeAtMost: Int64? = nil,
        ownerUserIDs: [String]? = nil,
        ancestorFolderIDs: [String]? = nil,
        searchIn: [SearchContentType]? = nil,
        itemType: SearchItemType? = nil,
        searchTrash: Bool? = nil,
        metadataFilter: MetadataSearchFilter? = nil,
        fields: [String]? = nil,
        offset: Int? = nil,
        limit: Int? = nil
    ) -> PagingIterator<SearchResult>

    Parameters

    query

    The text to serach for.

    scope

    The scope of content to search within; admins can search within their entire enterprise.

    fileExtensions

    Limit the search to files with the given extensions.

    createdAfter

    Limit the search to items created after this date.

    createdBefore

    Limit the search to items created before this date.

    updatedAfter

    Limit the search to items updated after this date.

    updatedBefore

    Limit the search to items updated before this date.

    sizeAtLeast

    Limit the search to items at least this size, in bytes.

    sizeAtMost

    Limit the search to items at most this size, in bytes.

    ownerUserIDs

    Limit the search to only items owned by one of the specified users.

    ancestorFolderIDs

    Limit the search to items within the specified folders. This includes all content under these folders, not just their immediate children.

    searchIn

    Specifies the areas where the search should look for the query string.

    itemType

    Limits the search to only items of the given type.

    searchTrash

    Whether to search in the trash. The options are mutually exclusive; either only trashed content or non-trashed content will be searched.

    metadataFilter

    The metadata template filters to limit the search results to.

    offest

    The offset within the collection of results to start from.

    limit

    The limit for how many search results will be returned.

    completion

    Called with the results of the search query, or an error if the request is unsuccessful.