`
iluoxuan
  • 浏览: 582247 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

XMPP -- 0055 search

 
阅读更多

XEP-0055: Jabber Search

Abstract: This specification provides canonical documentation of the jabber:iq:search namespace currently in use within the Jabber community.
Author: Peter Saint-Andre
Copyright: © 1999 - 2013 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status: Active
Type: Historical
Version: 1.3
Last Updated: 2009-09-15

NOTICE: This Historical specification provides canonical documentation of a protocol that is in use within the Jabber/XMPP community. This document is not a standards-track specification within the XMPP Standards Foundation's standards process; however, it might be converted to standards-track in the future or might be obsoleted by a more modern protocol.


Table of Contents


1. Introduction

This specification documents a protocol currently used to search information repositories on the Jabber network. To date, the jabber:iq:search protocol has been used mainly to search for people who have registered with user directories (e.g., the "Jabber User Directory" hosted at users.jabber.org). However, the jabber:iq:search protocol is not limited to user directories, and could be used to search other Jabber information repositories (such as chatroom directories) or even to provide a Jabber interface to conventional search engines.

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 [1] protocol, as described below.

2. Use Cases

2.1 Searching

搜索一个字段

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

Example 1. Requesting Search Fields

<iqtype='get'
    from='romeo@montague.net/home'
    to='characters.shakespeare.lit'
    id='search1'
    xml:lang='en'>
  <queryxmlns='jabber:iq:search'/>
</iq>
    

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

Example 2. Receiving Search Fields

<iqtype='result'
    from='characters.shakespeare.lit'
    to='romeo@montague.net/home'
    id='search1'
    xml:lang='en'>
  <queryxmlns='jabber:iq:search'>
    <instructions>
      Fill in one or more fields to search
      for any matching Jabber users.
    </instructions>
    <first/>
    <last/>
    <nick/>
    <email/>
  </query>
</iq>
    

The user MAY then submit a search request, specifying values for any desired fields:

Example 3. Submitting a Search Request

<iqtype='set'
    from='romeo@montague.net/home'
    to='characters.shakespeare.lit'
    id='search2'
    xml:lang='en'>
  <queryxmlns='jabber:iq:search'>
    <last>Capulet</last>
  </query>
</iq>
    

The service SHOULD then return a list of search results that match the values

provided:

服务器必须返回匹配结果值的搜索结果列表

Example 4. Receiving Search Results

<iqtype='result'
    from='characters.shakespeare.lit'
    to='romeo@montague.net/home'
    id='search2'
    xml:lang='en'>
  <queryxmlns='jabber:iq:search'>
    <itemjid='juliet@capulet.com'>
      <first>Juliet</first>
      <last>Capulet</last>
      <nick>JuliC</nick>
      <email>juliet@shakespeare.lit</email>
    </item>
    <itemjid='tybalt@shakespeare.lit'>
      <first>Tybalt</first>
      <last>Capulet</last>
      <nick>ty</nick>
      <email>tybalt@shakespeare.lit</email>
    </item>
  </query>
</iq>
    

If there are no matching directory entries, the service MUST return an empty <query/> element:

如果没有匹配的实体,服务器必须返回一个空的<query/>节点

Example 5. Service Informs User that No Records Match

<iqtype='result'
    from='characters.shakespeare.lit'
    to='romeo@montague.net/home'
    id='search2'
    xml:lang='en'>
  <queryxmlns='jabber:iq:search'/>
</iq>
    

3. Extensibility

The fields defined in the 'jabber:iq:search' namespace are strictly limited to those specified in the schema. If a host needs to gather additional information, Data Forms SHOULD be used; a host MUST NOT add new fields to the 'jabber:iq:search' namespace. Support for extensibility via Data Forms is RECOMMENDED, but is not required for compliance with this document.

The extensibility mechanism for searching makes use of a hidden FORM_TYPE field for the purpose of standardizing field names within the form, as defined in Field Standardization for Data Forms [2]. Implementations supporting this extensibility mechanism SHOULD support field standardization as well.

Example 6. Entity Requests Search Fields from Service

<iqtype='get'
    from='juliet@capulet.com/balcony'
    to='characters.shakespeare.lit'
    id='search3'
    xml:lang='en'>
  <queryxmlns='jabber:iq:search'/>
</iq>
  

Example 7. Host Returns Search Form to Entity

<iqtype='result'
    from='characters.shakespeare.lit'
    to='juliet@capulet.com/balcony'
    id='search3'
    xml:lang='en'>
  <queryxmlns='jabber:iq:search'>
    <instructions>
      Use the enclosed form to search. If your Jabber client does not
      support Data Forms, visit http://shakespeare.lit/
    </instructions>
    <xxmlns='jabber:x:data'type='form'>
      <title>User Directory Search</title>
      <instructions>
        Please provide the following information
        to search for Shakespearean characters.
      </instructions>
      <fieldtype='hidden'
             var='FORM_TYPE'>
        <value>jabber:iq:search</value>
      </field>
      <fieldtype='text-single'
             label='Given Name'
             var='first'/>
      <fieldtype='text-single'
             label='Family Name'
             var='last'/>
      <fieldtype='list-single'
             label='Gender'
             var='x-gender'>
        <optionlabel='Male'><value>male</value></option>
        <optionlabel='Female'><value>female</value></option>
      </field>
    </x>
  </query>
</iq>
  

Example 8. Entity Submits Search Form

<iqtype='set'
    from='juliet@capulet.com/balcony'
    to='characters.shakespeare.lit'
    id='search4'
    xml:lang='en'>
  <queryxmlns='jabber:iq:search'>
    <xxmlns='jabber:x:data'type='submit'>
      <fieldtype='hidden'var='FORM_TYPE'>
        <value>jabber:iq:search</value>
      </field>
      <fieldvar='x-gender'>
        <value>male</value>
      </field>
    </x>
  </query>
</iq>
  

Example 9. Service Returns Search Results

<iqtype='result'
    from='characters.shakespeare.lit'
    to='juliet@capulet.com/balcony'
    id='search4'
    xml:lang='en'>
  <queryxmlns='jabber:iq:search'>
    <xxmlns='jabber:x:data'type='result'>
      <fieldtype='hidden'var='FORM_TYPE'>
        <value>jabber:iq:search</value>
      </field>
      <reported>
        <fieldvar='first'label='Given Name'type='text-single'/>
        <fieldvar='last'label='Family Name'type='text-single'/>
        <fieldvar='jid'label='Jabber ID'type='jid-single'/>
        <fieldvar='x-gender'label='Gender'type='list-single'/>
      </reported>
      <item>
        <fieldvar='first'><value>Benvolio</value></field>
        <fieldvar='last'><value>Montague</value></field>
        <fieldvar='jid'><value>benvolio@montague.net</value></field>
        <fieldvar='x-gender'><value>male</value></field>
      </item>
      <item>
        <fieldvar='first'><value>Romeo</value></field>
        <fieldvar='last'><value>Montague</value></field>
        <fieldvar='jid'><value>romeo@montague.net</value></field>
        <fieldvar='x-gender'><value>male</value></field>
      </item>
    </x>
  </query>
</iq>
  

4. Internationalization Considerations

The intent of the <first/> and <last/> elements (and associated data form fields) is that they map to given name and family name, respectively. Therefore, cultures that place the family name first and the given name second (e.g., as is done in China) would use <first/> for the given name and <last/> for the family name, NOT the other way around.

For example, the name of the Chinese philosopher Confucius would be rendered as shown below because his given name was Qui and his family name was Kong.

Example 10. Internationalization of names

<iqtype='submit'
    from='confucius@scholars.lit/home'
    to='registrar.scholars.lit'
    id='kj3b157n'
    xml:lang='en'>
  <queryxmlns='jabber:iq:register'>
    <username>confucius</username>
    <first>Qui</first>
    <last>Kong</last>
  </query>
</iq>
  

5. Security Considerations

There are no security features or concerns related to this proposal.

6. IANA Considerations

This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [3].

7. XMPP Registrar Considerations

The XMPP Registrar [4] shall include the following information in its registries.

7.1 Protocol Namespaces

The XMPP Registrar includes the 'jabber:iq:search' namespace in its registry of protocol namespaces.

7.2 Field Standardization

The following fields are reserved for use within jabber:x:data forms scoped by a FORM_TYPE of 'jabber:iq:search'; additional fields MAY be added via the XMPP Registrar's normal registration process but are outside the scope of this document.

Registry Submission

<form_type>
  <name>jabber:iq:search</name>
  <doc>XEP-0055</doc>
  <desc>Forms enabling directory searches.</desc>
  <field
      var='first'
      type='text-single'
      label='Given Name'/>
  <field
      var='last'
      type='text-single'
      label='Family Name'/>
  <field
      var='nick'
      type='text-single'
      label='Nickname'/>
  <field
      var='email'
      type='text-single'
      label='Email Address'/>
</form_type>
    

8. XML Schema

 

<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='jabber:iq:search'
    xmlns='jabber:iq:search'
    elementFormDefault='qualified'>

  <xs:importnamespace='jabber:x:data'
             schemaLocation='http://www.xmpp.org/schemas/x-data.xsd'/>

  <xs:annotation>
    <xs:documentation>
      The protocol documented by this schema is defined in
      XEP-0055: http://www.xmpp.org/extensions/xep-0055.html
    </xs:documentation>
  </xs:annotation>

  <xs:elementname='query'>
    <xs:complexType>
      <xs:choice>
        <xs:allxmlns:xdata='jabber:x:data'>
          <xs:elementname='instructions'type='xs:string'/>
          <xs:elementname='first'type='xs:string'/>
          <xs:elementname='last'type='xs:string'/>
          <xs:elementname='nick'type='xs:string'/>
          <xs:elementname='email'type='xs:string'/>
          <xs:elementref='xdata:x'minOccurs='0'/>
        </xs:all>
        <xs:elementref='item'minOccurs='0'maxOccurs='unbounded'/>
      </xs:choice>
    </xs:complexType>
  </xs:element>

  <xs:elementname='item'>
    <xs:complexType>
      <xs:all>
        <xs:elementname='first'type='xs:string'/>
        <xs:elementname='last'type='xs:string'/>
        <xs:elementname='nick'type='xs:string'/>
        <xs:elementname='email'type='xs:string'/>
      </xs:all>
      <xs:attributename='jid'type='xs:string'use='required'/>
    </xs:complexType>
  </xs:element>

</xs:schema>
  

 

分享到:
评论

相关推荐

    XMPP开发总结语录

    - 设置`Header Search Paths`,添加`/usr/include/libxml2`。 - **导入其他库**: - 包括`Authentication`、`Categories`、`Core`、`Utilities`等。 - 导入这些库后可能会出现错误提示,此时需要进一步导入`...

    Old-Remetric-Ember:Remetric.com

    段(仅保存/命名过滤器)/ ElasticSearch 聊天 / XMPP - 每天 2 次会议试用 给注册用户的自动消息(使用后续应用程序) 以编程方式设置访问者的 API 听剧本 当新表单提交时,发送电子邮件! 当organization....

    利用elasticsearch和redis检索和存储十亿信息.docx

    客户端使用XMPP协议连接到服务器,服务器使用Elasticsearch和Redis来存储和检索信息。 知识点六: HipChat的扩展性 HipChat的架构具有很高的扩展性,可以轻松地 horizontal scaling到数十个服务器。这种架构使...

    Android中基于XMPP协议实现IM聊天程序与多人聊天室

    - `jabber:iq:search`:允许用户查询服务器上的其他用户信息。 - `jabber:iq:register`:处理用户注册请求。 - `jabber:x:iq:roster`:花名册管理相关操作。 - `jabber:x:conference`:发送会议邀请。 - `jabber:x:...

    openfire服务端实现

    - 设计数据存储方案,可以选择直接存储在Openfire内置的数据库(如HSQLDB或MySQL),或者使用外部存储如MongoDB或Elasticsearch。 - 实现插件逻辑,包括消息的抓取、解析、存储以及提供查询接口。 - 在Openfire...

    kaidan-release-v0.4.2.zip

    [Kaidan MUC](https://search.jabbercat.org/api/1.0/badge?address=kaidan@muc.kaidan.im)](https://i.kaidan.im) [![Flatpak Build Status](https://binary-factory.kde.org/buildStatus/icon?job=Kaidan_flatpak...

    利用elasticsearch和redis检索和存储十亿信息.doc

    HipChat的成功还在于其丰富的功能,如搜索历史、API集成、多平台客户端支持以及对XMPP协议的兼容,这使其能够无缝对接各种XMPP客户端。HipChat的本地客户端支持PDF浏览、自定义表情符号等功能,提升了用户体验。 ...

    P2P 资料搜索引擎的研究和设计

    &lt;iq type='set' from='romeo@montague.net/home' to='jerry@montague.net/home' id='search' xml:lang='en'&gt; &lt;repository&gt;informationtechnology &lt;keywords&gt;p2p knowledge management &lt;searchwords&gt;XMPPI M ...

    url.rar_The Question

    * All other protocols `mailto`, `xmpp`, `aim`, `sftp`, `foo`, etc will be postfixed with `:` (colon) * `auth` will be used if present. * `hostname` will only be used if `host` is absent. * `port` ...

    SMS_Real_Time_Search

    ### SMS_Real_Time_Search #### 执行摘要 随着社交媒体平台的快速发展与普及,用户每天在社交网络上发布的各类内容已超过2.3亿条。这些内容包括视频、图片、推文(tweets)、Facebook状态更新、博客文章、评论、...

    邮件系统手册

    - **TurboIMCTRL服务/XMPP(即时通讯)服务**:集成即时通讯功能,增强内部沟通效率。 - **数据传输中转服务/BICALL服务**:支持数据的高效传输,提高业务处理速度。 - **TurboIM模块设置**:自定义即时消息服务...

    pushlet聊天工具编辑中。。。。

    - **XMPP(Extensible Messaging and Presence Protocol)**:一种基于XML的开放标准,常用于即时通讯应用。 - **自定义协议**:有些聊天工具可能会设计自己的协议以优化性能或满足特定需求。 4. **编程语言与...

    藏经阁-异步场景下的全栈溯源.pdf

    2. ElasticSearch:使用 ElasticSearch 来存储和分析日志。 3. APM:使用 APM 来监控应用性能。 4. Auto Instrument:使用 Auto Instrument 来自动监控应用性能。 5. Add TransactionId to Message Header:在消息头...

    Python接收Gmail新邮件并发送到gtalk的方法

    通过server.search(None, "(UNSEEN)")来搜索未读邮件,然后将结果中的邮件ID提取出来,并通过循环来逐一处理。对于每一封邮件,我们使用server.fetch(num, '(RFC822)')来获取邮件内容,并用email.message_from_...

    Internet协议标准|Internet协议标准.rar

    it relies on search by title and keyword.] Applications and Real-Time: EPP | FTP | HTTP | iCalendar | IDNA | IMAP | LDAP | MIME | OAuth | POP3 | URN | vCard | XMPP | RTSP | RTP | SDP | SIP | VoIP ...

    openfire的插件

    10. **search.jar**:搜索插件提供用户和群组的搜索功能,允许用户通过关键词快速找到所需的信息,增强了Openfire的可查找性。 综上所述,这些.jar文件涵盖了Openfire的主要服务和功能扩展,从视频会议到用户管理,...

Global site tag (gtag.js) - Google Analytics