catalog.api.controllers package#

Submodules#

catalog.api.controllers.search_controller module#

class catalog.api.controllers.search_controller.RankFeature(_expand__to_dot=True, **params)#

Bases: Query

name = 'rank_feature'#
catalog.api.controllers.search_controller.get_sources(index)#

Given an index, find all available data sources and return their counts.

Parameters:

index – An Elasticsearch index, such as ‘image’.

Returns:

A dictionary mapping sources to the count of their images.`

catalog.api.controllers.search_controller.related_media(uuid, index, request, filter_dead)#

Given a UUID, find related search results.

catalog.api.controllers.search_controller.search(search_params: Any, index: Literal['image', 'audio'], page_size: int, ip: int, request: Request, filter_dead: bool, page: int = 1) tuple[list[elasticsearch_dsl.response.hit.Hit], int, int]#

Perform a ranked paginated search from the set of keywords and, optionally, filters.

Parameters:
  • search_params – Search parameters. See :class: ImageSearchQueryStringSerializer.

  • index – The Elasticsearch index to search (e.g. ‘image’)

  • page_size – The number of results to return per page.

  • ip – The user’s hashed IP. Hashed IPs are used to anonymously but

uniquely identify users exclusively for ensuring query consistency across Elasticsearch shards. :param request: Django’s request object. :param filter_dead: Whether dead links should be removed. :param page: The results page number. :return: Tuple with a List of Hits from elasticsearch, the total count of pages, and number of results.

Module contents#