Sdk

Search JSON

Build a Lomkit search payload (filters, includes, aggregates, instructions, pagination).

Search JSON

Search uses a structured JSON body under the search key.

Full example

final res = await repo.search(
  text: TextSearch(value: 'example'),
  page: 1,
  limit: 20,
  scopes: [Scope(name: 'active')],
  filters: [
    // Explicit null is supported
    Filter(field: 'status', operator: '=', value: null),
  ],
  sorts: [Sort(field: 'created_at', direction: 'desc')],
  selects: [Select(field: 'id'), Select(field: 'name')],
  includes: [
    Include(
      relation: 'author',
      selects: [Select(field: 'id'), Select(field: 'name')],
      includes: [Include(relation: 'company')],
    ),
  ],
  aggregates: [
    Aggregate(relation: 'comments', type: 'count', field: 'id'),
  ],
  instructions: [
    Instruction(
      name: 'customInstruction',
      fields: [
        InstructionField(field: 'flag', value: true),
        InstructionField(field: 'note', value: null),
      ],
    ),
  ],
);

Notes

  • Filter.value can be null and will be sent explicitly in JSON.
  • Pagination uses page + limit.