Class SearchManager

  • All Implemented Interfaces:
    ExtensionProtocol

    public final class SearchManager
    extends Object
    implements ExtensionProtocol
    The search manager allows to perform search requests on a server or service component according to XEP-0055: Jabber Search.

    1. Introduction

    The basic functionality is to query an information repository regarding the possible search fields, to send a search query, and to receive search results. Note well that there is currently no mechanism for paging through results or limiting the number of "hits", and that the allowable search fields are limited to those defined in the XML schema; however, extensibility MAY be provided via the Data Forms (XEP-0004) protocol.

    • Method Detail

      • discoverSearchFields

        public AsyncResult<Search> discoverSearchFields​(Jid service)
        Discovers the supported search fields of a service.

        2.1 Searching

        In order to search an information respository, a user first needs to discover what search fields are supported by the service.

        The service MUST then return the possible search fields to the user, and MAY include instructions.

        Parameters:
        service - The service address.
        Returns:
        The async result with the possible search fields and instructions or null, if search is not supported. Search fields are supported if they are not null.
      • search

        public AsyncResult<Search> search​(Search search,
                                          Jid service)
        Performs a search on the given service with given search parameters. Note that this method blocks the current thread until a response has received.
        Parameters:
        search - The search parameters.
        service - The service, which will perform the search, usually a server or server component.
        Returns:
        The async result with the search result (see Search.getItems()) or null if search is not supported.
      • getNamespace

        public final String getNamespace()
        Description copied from interface: ExtensionProtocol
        The protocol's main namespace. This is used to uniquely identify the extension protocol.
        Specified by:
        getNamespace in interface ExtensionProtocol
        Returns:
        The main namespace.
      • isEnabled

        public final boolean isEnabled()
        Description copied from interface: ExtensionProtocol
        Indicates whether this protocol is enabled.
        Specified by:
        isEnabled in interface ExtensionProtocol
        Returns:
        true, if enabled; false if disabled.