Lime Web Components API Documentation - v7.4.0
    Preparing search index...

    Interface SearchResponseBeta

    Response from LimeObjectRepository.search.

    Carries the matching objects and their total, plus the number of hits per limetype. This is not an ObjectResponse: search reports hit counts under aggregates rather than the aggregate calculations a query returns, and never carries totalRelations.

    import { PlatformServiceName } from '@limetech/lime-web-components';

    const limetypes = platform.get(PlatformServiceName.LimeTypeRepository);
    const repository = platform.get(PlatformServiceName.LimeObjectRepository);

    // `limit: 0` reports the counts without returning any objects.
    const response = await repository.search('Lundalogik', { limit: 0 });

    for (const [name, [hits]] of Object.entries(response.aggregates ?? {})) {
    const limetype = limetypes.getLimeType(name);

    console.log(
    `${limetype?.localname.plural ?? name}: ${hits.totalCount ?? 0}`
    );
    }
    interface SearchResponse {
        aggregates?: SearchHitCounts;
        objects: LimeObjectRecord[];
        totalCount: number;
    }
    Index

    Properties

    aggregates?: SearchHitCounts

    Number of hits per limetype, keyed by limetype name.

    The platform reports one count per limetype, so each entry holds a single SearchHitCount: { company: [{ totalCount: 5 }] }.

    A limetype that produced no hits is usually left out entirely rather than reported as zero, so treat a missing key as zero.

    objects: LimeObjectRecord[]

    Objects that matched the query, across every limetype searched.

    Ordered by search score with the best match first, and capped by SearchOptions.limit. Objects of different limetypes are mixed together, so read _limetype to tell them apart.

    These records carry _id, _limetype, _descriptive and the properties covered by the search index, not the full object. Load the object by id when you need the rest.

    totalCount: number

    Total number of matching objects across every limetype that was counted.

    Not capped by SearchOptions.limit, so this can exceed objects.length. It is also wider than objects when hit counts cover limetypes that were counted but not returned, so prefer the per-limetype counts in aggregates when reporting on what came back.