search ====== .. py:module:: wow.search .. autoapi-nested-parse:: Filters for Battle.net search endpoints. Search methods take ``filters``, a mapping from a document field to a value:: client.items.search( filters={ "item_class.id": 2, # equals "quality.type": ["EPIC", "LEGENDARY"], # any of "required_level": Range(50, 60), # 50 <= level <= 60 "inventory_type.type": Not("SHIELD"), # not equal }, order_by=["level:desc", "id"], ) Field names follow the search document, with dots for nesting. Localized fields take a locale suffix, as in ``name.en_US``. .. py:data:: MAX_PAGE_SIZE :type: Final :value: 1000 The largest ``page_size`` Battle.net accepts, and also the most results one query returns. .. py:class:: Range Match a numeric field between two bounds; leave one out for an open range. :ivar min: The lower bound, or ``None`` for no lower bound. :ivar max: The upper bound, or ``None`` for no upper bound. :ivar inclusive: Whether the bounds themselves match. .. py:attribute:: min :type: int | None :value: None .. py:attribute:: max :type: int | None :value: None .. py:attribute:: inclusive :type: bool :value: True .. py:method:: encode() -> str Render Blizzard's range syntax, such as ``[50,60]`` or ``(,77)``. .. py:class:: Not Match documents whose field is not this value. :ivar value: The value to exclude. .. py:attribute:: value :type: Scalar .. py:type:: FilterValue :canonical: Scalar | bool | Range | Not | Sequence[Scalar] equals for a scalar, any-of for a sequence, plus :class:`Range` and :class:`Not`. :type: A filter value .. py:function:: encode_search(filters: collections.abc.Mapping[str, FilterValue] | None, *, order_by: str | collections.abc.Sequence[str] | None, page: int, page_size: int) -> dict[str, str | int] Turn search arguments into query parameters. :raises ValueError: ``page`` or ``page_size`` is out of range, or a sequence filter is empty.