Skip to content

Feature request: distinct and withSearchIndex #833

@widavies

Description

@widavies

Is it possible to support using distinct and withSearchIndex together?

Something like:

  return stream(ctx.db, schema)
    .query('addresses')
    .withSearchIndex(`by_state`, (si) => si.search('state', 'N'))
    .order('asc')
    .distinct(['state'])
    .paginate(args.paginationOpts);

The idea is that if addresses contains 1000s of address with state NY and 1000s with NJ, searching for N does not always return all addresses with states beginning with N because it may exhaust the initialNumItems in the usePaginatedQuery before it reaches unique values.

Relevant source:

withSearchIndex(_indexName: any, _searchFilter: any): any {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions