Open hamzaozturk opened 4 years ago
I believe that you're right in that this plugin does not follow the specification, but not quite right in the reason why.
When a search form is requested from the plugin, the following form is returned. From this, it can be deduced that this plugin offers a form with only one text input field, and a couple of boolean flags (that indicate to what properties the text input field should be checked).
It's definitely not what is being defined in XEP-0055, and offering a XEP-0055 compliant search would be good. At the same time, I worry about other clients that now depend on the existing behavior. We will need to find a solution that will work for both.
<iq to='search.example.org' id='BJN9L-54' type='get'>
<query xmlns='jabber:iq:search'/>
</iq>
<iq type="result" id="BJN9L-54" from="search.example.org" to="test@example.org/one-tjvzu">
<query xmlns="jabber:iq:search">
<instructions>
The following fields are available for searching. Wildcard (*) characters are allowed as part of the query.
</instructions>
<first/>
<last/>
<nick/>
<email/>
<x xmlns="jabber:x:data" type="form">
<title>
Advanced User Search
</title>
<instructions>
The following fields are available for searching. Wildcard (*) characters are allowed as part of the query.
</instructions>
<field var="FORM_TYPE" type="hidden">
<value>
jabber:iq:search
</value>
</field>
<field var="search" type="text-single" label="Search">
<required/>
</field>
<field var="Username" type="boolean" label="Username">
<value>
1
</value>
</field>
<field var="Name" type="boolean" label="Name">
<value>
1
</value>
</field>
<field var="Email" type="boolean" label="Email">
<value>
1
</value>
</field>
</x>
</query>
</iq>
If i send this stanza to the server, it gives response like below:
However, according to the XEP-0055, it should give like this:
It looks like, mapping all fields to the name causes to this issue.
https://github.com/igniterealtime/openfire-search-plugin/blob/8c1747b5f5f6b1eef2a1e6a77205489ee33faa8a/src/java/org/jivesoftware/openfire/plugin/SearchPlugin.java#L129
Whatever field sent will not make any difference. It will always search in the name field except email