Learn R Programming

hdar (version 1.0.5)

SearchResults: SearchResults Class

Description

This class handles the storage and manipulation of search results including downloading resources based on a search query.

SearchResults

Arguments

Public fields

results

Stores the search results data.

total_count

Stores the total count of results' element.

total_size

Stores the total size of results

Methods


Method new()

Initializes a new SearchResults object with the specified client, results, and dataset identifier.

Usage

SearchResults$new(client, results, dataset_id)

Arguments

client

An object containing the API client used to interact with the dataset.

results

List containing search results.

dataset_id

The identifier for the dataset being queried.

Returns

SearchResult instance


Method download()

Downloads resources based on stored results or selected indices of results.

Usage

SearchResults$download(
  output_dir,
  selected_indexes,
  stop_at_failure = TRUE,
  force = FALSE,
  prompt = TRUE
)

Arguments

output_dir

A string specifying the directory where downloaded files will be saved.

selected_indexes

Optional; indices of the specific results to download.

stop_at_failure

Optional; controls whether the download process of multiple files should immediately stop upon encountering the first failure.

force

Optional; forces the download even if the file already exists in the specified output directory.

prompt

Optional; enables all user prompts for decisions during file downloads. Defaults to true.

Returns

Nothing returned but downloaded files are saved at the specified location.


Method clone()

The objects of this class are cloneable with this method.

Usage

SearchResults$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.