Class: Search

Search(client) → {void}

Simple manager for interacting with the search endpoints and actions.

Constructor

Parameters:
Name Type Description
client BoxClient The Box API Client that is responsible for making calls to the API
Source:
Returns:
Type
void

Members

(readonly) scopes :SearchScope

Valid search scopes
Type:
Source:

Methods

query(searchString, optionsopt, callbackopt) → {Promise.<Object>}

Searches Box for the given query.
Parameters:
Name Type Attributes Description
searchString string The query string to use for search
options Object <optional>
Additional search filters. Can be left null in most cases.
Properties
Name Type Attributes Default Description
scope SearchScope <optional>
The scope on which you want search. Can be user_content for a search limited to the current user or enterprise_content to search an entire enterprise
file_extensions string <optional>
Single or comma-delimited list of file extensions to filter against
created_at_range string <optional>
Date range for filtering on item creation time, e.g. '2014-05-15T13:35:01-07:00,2014-05-17T13:35:01-07:00'
updated_at_range string <optional>
Date range for filtering on item update time, e.g. '2014-05-15T13:35:01-07:00,2014-05-17T13:35:01-07:00'
size_range string <optional>
Range of item sizes (in bytes) to filter on, as lower_bound,upper_bound. Either bound can be ommitted, e.g. ',100000' for <= 100KB
owner_user_ids string <optional>
Comma-delimited list of user IDs to filter item owner against
ancestor_folder_ids string <optional>
Comma-delimited list of folder IDs, search results will contain only items in these folders (and folders within them)
content_types string <optional>
Query within specified comma-delimited fields. The types can be name, description, file_content, comments, or tags
type string <optional>
The type of objects you want to include in the search results. The type can be file, folder, or web_link
trash_content string <optional>
non_trashed_only Controls whether to search in the trash. The value can be trashed_only or non_trashed_only
mdfilters Array.<SearchMetadataFilter> <optional>
Searches for objects with a specific metadata object association. Searches with this parameter do not require a query string
include_recent_shared_links boolean <optional>
Determines whether to include items accessible only via shared link in the response.
fields string <optional>
Comma-delimited list of fields to be included in the response
limit int <optional>
30 The number of search results to return, max 200
offset int <optional>
0 The search result at which to start the response, must be a multiple of limit
sort string <optional>
The field on which the results should be sorted, e.g. "modified_at"
direction string <optional>
The sort direction: "ASC" for ascending and "DESC" for descending
callback APIRequest~Callback <optional>
passed the new comment data if it was posted successfully
Source:
Returns:
A promise resolving to the collection of search results
Type
Promise.<Object>

query(searchString, optionsopt, callbackopt) → {Promise.<Object>}

Searches Box for the given query.
Parameters:
Name Type Attributes Description
searchString string The query string to use for search
options Object <optional>
Additional search filters. Can be left null in most cases.
Properties
Name Type Attributes Default Description
scope SearchScope <optional>
The scope on which you want search. Can be user_content for a search limited to the current user or enterprise_content to search an entire enterprise
file_extensions string <optional>
Single or comma-delimited list of file extensions to filter against
created_at_range string <optional>
Date range for filtering on item creation time, e.g. '2014-05-15T13:35:01-07:00,2014-05-17T13:35:01-07:00'
updated_at_range string <optional>
Date range for filtering on item update time, e.g. '2014-05-15T13:35:01-07:00,2014-05-17T13:35:01-07:00'
size_range string <optional>
Range of item sizes (in bytes) to filter on, as lower_bound,upper_bound. Either bound can be ommitted, e.g. ',100000' for <= 100KB
owner_user_ids string <optional>
Comma-delimited list of user IDs to filter item owner against
ancestor_folder_ids string <optional>
Comma-delimited list of folder IDs, search results will contain only items in these folders (and folders within them)
content_types string <optional>
Query within specified comma-delimited fields. The types can be name, description, file_content, comments, or tags
type string <optional>
The type of objects you want to include in the search results. The type can be file, folder, or web_link
trash_content string <optional>
non_trashed_only Controls whether to search in the trash. The value can be trashed_only or non_trashed_only
mdfilters Array.<SearchMetadataFilter> <optional>
Searches for objects with a specific metadata object association. Searches with this parameter do not require a query string
include_recent_shared_links boolean <optional>
Determines whether to include items accessible only via shared link in the response.
fields string <optional>
Comma-delimited list of fields to be included in the response
limit int <optional>
30 The number of search results to return, max 200
offset int <optional>
0 The search result at which to start the response, must be a multiple of limit
sort string <optional>
The field on which the results should be sorted, e.g. "modified_at"
direction string <optional>
The sort direction: "ASC" for ascending and "DESC" for descending
callback APIRequest~Callback <optional>
passed the new comment data if it was posted successfully
Source:
Returns:
A promise resolving to the collection of search results
Type
Promise.<Object>