Class Search

Hierarchy

  • Search

Constructors

Properties

_accessKeysService: AccessKeysService
_client: Client
_customPackageSynonyms?: SynonymsConfig
_dataCache: DataCache
_graphConnector: GraphConnector
_runtimeConfig: RuntimeConfig
_schemaManager: SchemaManager
connectors: Promise<Record<string, QueryConnector>>
s3Client: S3

Methods

  • Parameters

    • sourceUuid: string
    • edgeLabel: string
    • destinationLabel: string
    • inverse: boolean
    • searchQuery: undefined | CSQL

    Returns CSQLEdge

  • Inject the relationship filter terms into the search query.

    Returns

    Parameters

    • searchQuery: undefined | CSQL
    • sourceUuid: string
    • sourceLabel: string
    • edgeLabel: string
    • destinationLabel: string
    • inverse: boolean

    Returns Promise<CSQLVertex>

  • Parameters

    • tenant: string
    • vertexId: string
    • accessKeys: string[]

    Returns Promise<void>

  • Parameters

    • body: any

    Returns Promise<ApiResponse<Record<string, any>, unknown>>

  • Parameters

    • body: any
    • from: number
    • size: number

    Returns Promise<ApiResponse<Record<string, any>, unknown>>

  • Parameters

    Returns Promise<{
        edge: any;
        traverseDestination: any;
        traverseSource: {
            created: string;
            id: string;
            label: string;
            tenant_id: string;
            updated: string;
        };
    }[][]>

  • Gets cache tags based on vertex type terms from a given query.

    This function takes a CSQL query and extracts cache tags related to vertex types. It gathers term filters, checks if they relate to vertex types, and extracts vertex type terms. It returns these terms as a sorted, deduplicated list. If no relevant vertex types are found, it returns null.

    Returns

    A sorted array of unique vertex type terms as cache tags, or null if none are found.

    Example

    // Example with a single value filter for vertex types:
    const query = {
    docType: 'vertex',
    termFilters: [
    { path: 'entity_type', term: 'User' }
    ],
    termsFilters: [
    { path: 'status', terms: ['active', 'blocked'] }
    ]
    };

    // The function will return the following cache tags:
    // ['User']

    Example

    // Example with multiple value filters for vertex types:
    const query = {
    docType: 'vertex',
    termFilters: [
    { path: 'status', term: 'active' }
    ],
    termsFilters: [
    { path: 'entity_type', terms: ['Team', 'Organisation'] }
    ]
    };

    // The function will return the following cache tags:
    // ['Team', 'Organisation']

    Example

    // Example for queries specifically related to edges:
    const query = {
    docType: 'edge',
    termFilters: [
    { path: 'entity_type', term: 'memberOf' }
    ],
    termsFilters: [
    { path: 'to_label', terms: ['Location', 'JobRole'] }
    ]
    };

    // The function will return the following cache tags:
    // ['Location', 'JobRole']

    Parameters

    • query: CSQL

      The CSQL query object containing filters and conditions.

    Returns null | string[]

  • Parameters

    • reply: ApiResponse<Record<string, any>, unknown>

    Returns Hit<{
        entity_id: string;
    }>[]

  • Parameters

    • sourceUuids: string[]
    • sourcesWithLabels: Record<string, string>
    • edgeLabel: string
    • destinationLabel: string
    • inverse: boolean

    Returns Promise<Record<string, RelationshipSpec>>

  • This handles the retrieval of the synonyms for a tenant.

    Returns

    the users synonyms

    Parameters

    • tenant: string

    Returns Promise<string[]>

  • This handles the generation of the key for a tenants synonyms file.

    Returns

    The S3 key for the synonyms JSON file

    Parameters

    • tenant: string

      The tenant UUID

    Returns string

  • Parameters

    Returns Promise<null | {
        count: any;
        data: {};
        entities: undefined | any[];
        facets: undefined | string;
        relationships: undefined | any[];
        results: Record<string, any>;
    }>

  • Prepares facets.

    Parameters

    • aggregations: any

    Returns undefined | string

  • Private

    Prepares the search results hits by mapping each hit to its entity ID and source.

    Returns

    • The JSON string representation of the search results.

    Parameters

    • vertexSearchResult: Hit<{
          entity_id: string;
      }>[]

      The array of vertex search results.

    Returns undefined | string

  • Prepares and runs ES's query.

    Parameters

    Returns Promise<{
        count: any;
        data: {};
        entities: undefined | any[];
        facets: undefined | string;
        relationships: undefined | any[];
        results: Record<string, any>;
    }>

  • This method is used to get search count only.

    Parameters

    • body: any

    Returns Promise<number>

  • Parameters

    Returns {
        labelsWithSources: Record<string, [string, ...string[]]>;
        sourceUuids: string[];
        sourcesWithLabels: Record<string, string>;
    }

    • labelsWithSources: Record<string, [string, ...string[]]>
    • sourceUuids: string[]
    • sourcesWithLabels: Record<string, string>
  • Decide whether to use search or graph to load the data.

    The general rule is that if we have filters in the list query arguments that depend on one or the other, we use whichever the filters require. If we have both, we throw an error. If we have neither, we fall back to the default preference (which should be configurable: TODO).

    Returns

    true for search, false for graph.

    Parameters

    • listQueryArguments: Partial<ParsedListQueryArguments>

      The list query arguments, which may include graph-based filters, search-based filters, or no filters at all.

    • context: undefined | KosmosUserContext<object>
    • operation: OperationTypeNode

    Returns boolean

  • Unsafely (i.e. bypassing access control) retrieve documents directly by UUID.

    This is intended for internal use, e.g. to allow the Search trait to compare updates against the previous indexed version. It should not be used to retrieve a document to be presented to the user, unless the IDs have already been subjected to access control checks.

    Parameters

    • entity_id: string[]

      The UUIDs of the documents.

    • tenant_id: string

      The UUID of the tenant.

    Returns Promise<any[]>

  • Validates a CSQL query object.

    Throws

    If the query is invalid or contains forbidden keys in the paths.

    Parameters

    • query: CSQL

      The CSQL query object to be validated.

    Returns void

Generated using TypeDoc