• Main function to fetch and filter gallery IDs based on various criteria. Implements a complex search and filter pipeline with multiple stages:

    1. Title-based search:

      • Each word in the title is hashed
      • B-tree is searched for each hash
      • Results are intersected
    2. Tag-based filtering:

      • Positive tags: Results must contain all tags
      • Negative tags: Results must not contain any tags
    3. Popularity-based ordering:

      • Optional sorting by different popularity metrics
    4. Range-based pagination:

      • Can be applied at HTTP level for simple queries
      • Applied after filtering for complex queries

    Parameters

    • options: {
          popularityOrderBy?: PopularityPeriod;
          range?: { end?: number; start?: number };
          tags?: Tag[];
          title?: string;
      } = {}

      Search and filter options

      • OptionalpopularityOrderBy?: PopularityPeriod

        Popularity sorting option

      • Optionalrange?: { end?: number; start?: number }

        Pagination range

        • Optionalend?: number

          End index

        • Optionalstart?: number

          Start index

      • Optionaltags?: Tag[]

        Array of tags to filter by

      • Optionaltitle?: string

        Title to search for

    Returns Promise<number[]>

    Array of matching gallery IDs

    // Search for galleries with specific title and tags
    const ids = await getGalleryIds({
    title: "search term",
    tags: [{name: "tag1", isNegative: false}],
    range: {start: 0, end: 10}
    });