Skip to content

[Search] Implement a background search service #61743

@lizozom

Description

@lizozom

Part of #61738

The background search service is responsible for

  • Tracking in memory mappings of sessionId to multiple searchIds (also tracking the user and request that generated that search.
  • Clearing out those mappings if they are stale.
  • Monitoring the existence of a saved object for that sessionId (indicating a background search was requested) and storing the search IDs into it.
  • Restore an searchId for a given sessionId from a saved object.

Tasks:

  • Define a saved object to represent a background search
  • Define a BackgroundSearch service
        interface BackgroundSearchService {
            /* Track a `searchId` in memory or on a background search saved object (if exists). */
            async trackId: (userId: string, sessionId: string, requestParams: any, searchId: string) => void;
            /* Get a `searchId` from a background search saved object */
            async getId(userId: string, sessionId: string, requestParams: any): string | undefined;
            /* Create a background search saved object for a given session. */
            async store(sessionId: string) => void;
        }
  • Define a route internal\search\bg (??) where client can send a sessionId and optionally a list of searchIds. Invoke backgroundSearch.store(sessionId) and trackId for each searchId.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions