internetarchive-ts - v0.1.0
    Preparing search index...

    Class IaAdvancedSearch<Fields>Beta

    This class represents an archive.org item search using the advancedSearch API endpoint.

    import { IaSearch } from "internetarchive-ts";

    const search = new IaAdvancedSearch(session, 'computer chronicles');

    console.log(`Results: ${await search.getNumFound()}`)
    for await (const result of search.getResultsGenerator()) {
    console.log(result);
    }

    Type Parameters

    • const Fields extends string[] | undefined

      Search fields, inferred by the search params. If not supplied, a default set of fields will be returned

    Hierarchy

    Index

    Constructors

    • Beta

      Create a new advanced search

      Type Parameters

      • const Fields extends string[] | undefined

        Search fields, inferred by the search params. If not supplied, a default set of fields will be returned

      Parameters

      • session: IaSession

        Session to use for API requests

      • query: string

        Search query

      • param2: {
            fields?: Fields;
            limit?: number;
            maxRetries?: number;
            rows?: number;
            scope?: IaScope;
            sorts?:
                | []
                | [IaSortOption]
                | [IaSortOption, IaSortOption]
                | [IaSortOption, IaSortOption, IaSortOption];
        } = {}
        • Optionalfields?: Fields

          Fields to include in the results. If not supplied, a standard set of fields will be returned. Regardless of which fields are supplied, the "identifier" field will always be included.

        • Optionallimit?: number

          Maximum number of retries for each API call (default: 5)

        • OptionalmaxRetries?: number
        • Optionalrows?: number
        • Optionalscope?: IaScope

          The scope of the query. Possible values are 'standard' or 'all'. The 'all' scope requires authorization

        • Optionalsorts?:
              | []
              | [IaSortOption]
              | [IaSortOption, IaSortOption]
              | [IaSortOption, IaSortOption, IaSortOption]

          Up to 3 sort options

      Returns IaAdvancedSearch<Fields>

    Properties

    fields?: string[]
    limit?: number
    maxRetries: number
    numFound: number | undefined
    query: string
    session: IaSession
    sorts: IaSortOption[]
    url: string

    Methods

    • Beta

      Fetches the number of results for the query of this instance.

      Returns Promise<number>

      Number of results for this search

    • Beta

      Get the number if items found by this query.

      Note that this number can change over time. The number also gets updated with every call to the search API.

      Returns Promise<number>

      Number of items found