search.controllers.simple package

Handle requests to support the simple search feature.

The primary entrypoint to this module is search(), which handles GET requests to the base search endpoint. It uses SimpleSearchForm to generate form HTML, validate request parameters, and produce informative error messages for the user.

search.controllers.simple.retrieve_document(document_id)[source]

Retrieve an arXiv paper by ID.

Parameters:

document_id (str) – arXiv identifier for the paper.

Returns:

  • dict – Metadata about the paper.
  • int – HTTP status code.
  • dict – Headers to add to the response.

Raises:
  • InternalServerError – Encountered error in search query.
  • NotFound – No such document
Return type:

Tuple[Dict[str, Any], int, Dict[str, Any]]

search.controllers.simple.search(request_params, archives=None)[source]

Perform a simple search.

This supports requests from both the form-based view (provided here) AND from the mini search widget displayed on all arXiv.org pages.

At a minimum, expects the parameter value in the GET request. This may be a match value for a search query, or an arXiv ID.

Parameters:
  • request_params (MultiDict) –
  • archives (list) – A list of archives within which the search should be performed.
Returns:

  • dict – Search result response data.
  • int – HTTP status code.
  • dict – Headers to add to the response.

Raises:

InternalServerError – Raised when there is a problem communicating with ES, or there was an unexpected problem executing the query.

Return type:

Tuple[Dict[str, Any], int, Dict[str, Any]]