xeps/xep-0055.xml

348 行
13 KiB
XML

<?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>