org.models.search ================= .. py:module:: org.models.search Classes ------- .. autoapisummary:: org.models.search.Search Module Contents --------------- .. py:class:: Search(request: onegov.org.request.OrgRequest, query: str, page: int) Bases: :py:obj:`onegov.core.collection.Pagination`\ [\ :py:obj:`Any`\ ] Provides collections with pagination, if they implement a few documented properties and methods. See :class:`onegov.ticket.TicketCollection` for an example. .. py:attribute:: results_per_page :value: 10 .. py:attribute:: request .. py:attribute:: query .. py:attribute:: page .. py:attribute:: number_of_results :type: int | None :value: None .. py:property:: available_documents :type: int .. py:property:: available_results :type: int .. py:property:: q :type: str Returns the user's query term from the search field of the UI .. py:method:: __eq__(other: object) -> bool Returns True if the current and the other Pagination instance are equal. Used to find the current page in a list of pages. .. py:method:: subset() -> sqlalchemy.orm.Query[Any] Returns an SQLAlchemy query containing all records that should be considered for pagination. .. py:property:: page_index :type: int Returns the current page index (starting at 0). .. py:method:: page_by_index(index: int) -> Search Returns the page at the given index. A page here means an instance of the class inheriting from the ``Pagination`` base class. .. py:property:: batch :type: tuple[Any, Ellipsis] Returns the elements on the current page. .. py:property:: load_batch_results :type: tuple[Any, Ellipsis] Load search results and sort upcoming events by occurrence start date. .. py:method:: apply_common_filters(query: Any) -> Any Applies common search filters like e.g. access filters. .. py:method:: generic_search() -> sqlalchemy.orm.Query[onegov.search.SearchIndex] .. py:method:: hashtag_search() -> sqlalchemy.orm.Query[onegov.search.SearchIndex] .. py:method:: load_batch(query: sqlalchemy.orm.Query[onegov.search.SearchIndex]) -> tuple[onegov.search.Searchable, Ellipsis] .. py:method:: feeling_lucky() -> str | None .. py:property:: subset_count :type: int Returns the total number of elements this pagination represents. .. py:method:: suggestions() -> tuple[str, Ellipsis]