aboutsummaryrefslogtreecommitdiff
path: root/xep-0055.xml
blob: e4f55ed5d272ccb4b9a483f3de4e6bc9fc34dabf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
  <!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
  <title>Jabber Search</title>
  <abstract>This specification provides canonical documentation of the jabber:iq:search namespace currently in use within the Jabber community.</abstract>
  &LEGALNOTICE;
  <number>0055</number>
  <status>Active</status>
  <type>Historical</type>
  <sig>Standards</sig>
  <dependencies>
    <spec>XMPP Core</spec>
    <spec>XEP-0004</spec>
  </dependencies>
  <supersedes/>
  <supersededby/>
  <shortname>iq-search</shortname>
  <schemaloc>
    <url>http://www.xmpp.org/schemas/iq-search.xsd</url>
  </schemaloc>
  &stpeter;
  <revision>
    <version>1.3</version>
    <date>2009-09-15</date>
    <initials>psa</initials>
    <remark><p>Clarified that &lt;first/&gt; and &lt;last/&gt; elements in fact always represent given name and family name, respectively.</p></remark>
  </revision>
  <revision>
    <version>1.2</version>
    <date>2004-03-22</date>
    <initials>psa</initials>
    <remark><p>Clarified scope (searching of any information repository, not just user directories); added search and result examples to the extensibility section.</p></remark>
  </revision>
  <revision>
    <version>1.1</version>
    <date>2004-01-06</date>
    <initials>psa</initials>
    <remark><p>Added XML schema; added text regarding extensibility via Data Forms; added FORM_TYPE submission.</p></remark>
  </revision>
  <revision>
    <version>1.0</version>
    <date>2003-01-09</date>
    <initials>psa</initials>
    <remark><p>Updated status to Active per vote of the Jabber Council.</p></remark>
  </revision>
  <revision>
    <version>0.1</version>
    <date>2002-11-01</date>
    <initials>psa</initials>
    <remark><p>Initial version.</p></remark>
  </revision>
</header>
<section1 topic='Introduction' anchor='intro'>
  <p>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.</p>
  <p>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 &xep0004; protocol, as described below.</p>
</section1>
<section1 topic='Use Cases' anchor='usecases'>
  <section2 topic="Searching" anchor='usecases-search'>
    <p>In order to search an information respository, a user first needs to discover what search fields are supported by the service:</p>
    <example caption="Requesting Search Fields"><![CDATA[
<iq type='get'
    from='romeo@montague.net/home'
    to='characters.shakespeare.lit'
    id='search1'
    xml:lang='en'>
  <query xmlns='jabber:iq:search'/>
</iq>
]]></example>
    <p>The service MUST then return the possible search fields to the user, and MAY include instructions:</p>
    <example caption="Receiving Search Fields"><![CDATA[
<iq type='result'
    from='characters.shakespeare.lit'
    to='romeo@montague.net/home'
    id='search1'
    xml:lang='en'>
  <query xmlns='jabber:iq:search'>
    <instructions>
      Fill in one or more fields to search
      for any matching Jabber users.
    </instructions>
    <first/>
    <last/>
    <nick/>
    <email/>
  </query>
</iq>
]]></example>
    <p>The user MAY then submit a search request, specifying values for any desired fields:</p>
    <example caption="Submitting a Search Request"><![CDATA[
<iq type='set'
    from='romeo@montague.net/home'
    to='characters.shakespeare.lit'
    id='search2'
    xml:lang='en'>
  <query xmlns='jabber:iq:search'>
    <last>Capulet</last>
  </query>
</iq>
]]></example>
    <p>The service SHOULD then return a list of search results that match the values provided:</p>
    <example caption="Receiving Search Results"><![CDATA[
<iq type='result'
    from='characters.shakespeare.lit'
    to='romeo@montague.net/home'
    id='search2'
    xml:lang='en'>
  <query xmlns='jabber:iq:search'>
    <item jid='juliet@capulet.com'>
      <first>Juliet</first>
      <last>Capulet</last>
      <nick>JuliC</nick>
      <email>juliet@shakespeare.lit</email>
    </item>
    <item jid='tybalt@shakespeare.lit'>
      <first>Tybalt</first>
      <last>Capulet</last>
      <nick>ty</nick>
      <email>tybalt@shakespeare.lit</email>
    </item>
  </query>
</iq>
]]></example>
    <p>If there are no matching directory entries, the service MUST return an empty &lt;query/&gt; element:</p>
    <example caption="Service Informs User that No Records Match"><![CDATA[
<iq type='result'
    from='characters.shakespeare.lit'
    to='romeo@montague.net/home'
    id='search2'
    xml:lang='en'>
  <query xmlns='jabber:iq:search'/>
</iq>
]]></example>
  </section2>
</section1>
<section1 topic='Extensibility' anchor='extensibility'>
  <p>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, <strong>Data Forms</strong> SHOULD be used; a host MUST NOT add new fields to the 'jabber:iq:search' namespace. Support for extensibility via <strong>Data Forms</strong> is RECOMMENDED, but is not required for compliance with this document.</p>
  <p>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 &xep0068;. Implementations supporting this extensibility mechanism SHOULD support field standardization as well.</p>
  <example caption='Entity Requests Search Fields from Service'><![CDATA[
<iq type='get'
    from='juliet@capulet.com/balcony'
    to='characters.shakespeare.lit'
    id='search3'
    xml:lang='en'>
  <query xmlns='jabber:iq:search'/>
</iq>
]]></example>
  <example caption='Host Returns Search Form to Entity'><![CDATA[
<iq type='result'
    from='characters.shakespeare.lit'
    to='juliet@capulet.com/balcony'
    id='search3'
    xml:lang='en'>
  <query xmlns='jabber:iq:search'>
    <instructions>
      Use the enclosed form to search. If your Jabber client does not
      support Data Forms, visit http://shakespeare.lit/
    </instructions>
    <x xmlns='jabber:x:data' type='form'>
      <title>User Directory Search</title>
      <instructions>
        Please provide the following information
        to search for Shakespearean characters.
      </instructions>
      <field type='hidden'
             var='FORM_TYPE'>
        <value>jabber:iq:search</value>
      </field>
      <field type='text-single'
             label='Given Name'
             var='first'/>
      <field type='text-single'
             label='Family Name'
             var='last'/>
      <field type='list-single'
             label='Gender'
             var='x-gender'>
        <option label='Male'><value>male</value></option>
        <option label='Female'><value>female</value></option>
      </field>
    </x>
  </query>
</iq>
]]></example>
  <example caption='Entity Submits Search Form'><![CDATA[
<iq type='set'
    from='juliet@capulet.com/balcony'
    to='characters.shakespeare.lit'
    id='search4'
    xml:lang='en'>
  <query xmlns='jabber:iq:search'>
    <x xmlns='jabber:x:data' type='submit'>
      <field type='hidden' var='FORM_TYPE'>
        <value>jabber:iq:search</value>
      </field>
      <field var='x-gender'>
        <value>male</value>
      </field>
    </x>
  </query>
</iq>
]]></example>
  <example caption='Service Returns Search Results'><![CDATA[
<iq type='result'
    from='characters.shakespeare.lit'
    to='juliet@capulet.com/balcony'
    id='search4'
    xml:lang='en'>
  <query xmlns='jabber:iq:search'>
    <x xmlns='jabber:x:data' type='result'>
      <field type='hidden' var='FORM_TYPE'>
        <value>jabber:iq:search</value>
      </field>
      <reported>
        <field var='first' label='Given Name' type='text-single'/>
        <field var='last' label='Family Name' type='text-single'/>
        <field var='jid' label='Jabber ID' type='jid-single'/>
        <field var='x-gender' label='Gender' type='list-single'/>
      </reported>
      <item>
        <field var='first'><value>Benvolio</value></field>
        <field var='last'><value>Montague</value></field>
        <field var='jid'><value>benvolio@montague.net</value></field>
        <field var='x-gender'><value>male</value></field>
      </item>
      <item>
        <field var='first'><value>Romeo</value></field>
        <field var='last'><value>Montague</value></field>
        <field var='jid'><value>romeo@montague.net</value></field>
        <field var='x-gender'><value>male</value></field>
      </item>
    </x>
  </query>
</iq>
]]></example>
</section1>
<section1 topic='Internationalization Considerations' anchor='i18n'>
  <p>The intent of the &lt;first/&gt; and &lt;last/&gt; 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 &lt;first/&gt; for the given name and &lt;last/&gt; for the family name, NOT the other way around.</p>
  <p>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.</p>
  <example caption="Internationalization of names"><![CDATA[
<iq type='submit'
    from='confucius@scholars.lit/home'
    to='registrar.scholars.lit'
    id='kj3b157n'
    xml:lang='en'>
  <query xmlns='jabber:iq:register'>
    <username>confucius</username>
    <first>Qui</first>
    <last>Kong</last>
  </query>
</iq>
]]></example>
</section1>
<section1 topic='Security Considerations' anchor='security'>
  <p>There are no security features or concerns related to this proposal.</p>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
  <p>This document requires no interaction with &IANA;.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  <p>The &REGISTRAR; shall include the following information in its registries.</p>
  <section2 topic='Protocol Namespaces' anchor='registrar-namespaces'>
    <p>The XMPP Registrar includes the 'jabber:iq:search' namespace in its registry of protocol namespaces.</p>
  </section2>
  <section2 topic='Field Standardization' anchor='registrar-formtypes'>
    <p>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.</p>
    <code caption='Registry Submission'><![CDATA[
<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>
]]></code>
  </section2>
</section1>
<section1 topic='XML Schema' anchor='schema'>
  <code><![CDATA[
<?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:import namespace='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:element name='query'>
    <xs:complexType>
      <xs:choice>
        <xs:all xmlns:xdata='jabber:x:data'>
          <xs:element name='instructions' type='xs:string'/>
          <xs:element name='first' type='xs:string'/>
          <xs:element name='last' type='xs:string'/>
          <xs:element name='nick' type='xs:string'/>
          <xs:element name='email' type='xs:string'/>
          <xs:element ref='xdata:x' minOccurs='0'/>
        </xs:all>
        <xs:element ref='item' minOccurs='0' maxOccurs='unbounded'/>
      </xs:choice>
    </xs:complexType>
  </xs:element>

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

</xs:schema>
]]></code>
</section1>
</xep>