Alokai
Legacy

Basics: Definitions

This section will cover accessing and reusing fragments of GraphQL queries definitions used internally.

Example

While modifying the set of fields in the query, consider using definitions to access internally used fragments for composition. This way, you can modify only what you need instead of rewriting the entire expect from scratch.

import { sdk } from '~/sdk'
import {
  definitions
} from '@vsf-enterprise/bloomreach-discovery-sdk';

const expectQuery = `
  ${definitions.queryItems}
  items {
    slug
    displayName
    description  
  }
`;

const data = await sdk.bloomreachDiscovery.findItemsByKeyword({
  text: 'Greenlee',
  expect: expectQuery
});

On this page