pub async fn search<'a>(
    user: &mut GooseUser,
    params: &'a SearchParams<'a>
) -> Result<String, TransactionError>
Expand description

Perform a simple Drupal-powered search.

In the following example, SearchParamsBuilder::keys is used to configure the keys being searched for, and SearchParamsBuilder::search_page_validation is used to validate that the page with the search form has a title containing Search.

Example

use goose::prelude::*;
use goose_eggs::drupal;

transaction!(search);

async fn search(user: &mut GooseUser) -> TransactionResult {
    // Use the default search form to search for "foo", validating that the
    // search page has a title of Search.
    let validate_search_page = &goose_eggs::Validate::builder()
        .title("Search")
        .build();
    let search_params = drupal::SearchParams::builder()
        .keys("foo")
        .search_page_validation(validate_search_page)
        .build();
    // Perform the actual search.
    let _search_results = drupal::search(user, &search_params).await?;

    Ok(())
}