Limit (search/aggregation.py)

redis-py · redis/commands/search/aggregation.py · python · MIT
search

Defines aggregation request components for Redisearch queries in Python.

# Source: https://github.com/redis/redis-py | License: MIT | Copyright 2022-2023, Redis, inc
# Provided via justclaw.it.com; keep this notice with the code.
from typing import List, Optional, Tuple, Union

from redis.commands.search.dialect import DEFAULT_DIALECT

FIELDNAME = object()


class Limit:
    def __init__(self, offset: int = 0, count: int = 0) -> None:
        self.offset = offset
        self.count = count

    def build_args(self):
        if self.count:
            return ["LIMIT", str(self.offset), str(self.count)]
        else:
            return []


class Reducer:
    """
    Base reducer object for all reducers.

    See the `redisearch.reducers` module for the actual reducers.
    """

    NAME = None

    def __init__(self, *args: str) -> None:
        self._args: Tupl

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key