Page MenuHomePhabricator

api.php opensearch returns only JSON
Closed, ResolvedPublic

Description

Author: josh.hight

Description:
Querying api.php using opensearch action returns only JSON responses and sends a
header that causes browsers to download the response as if it were a file. The
format parameter is ignored. Using opensearch should return the response in
xfhtml by default, like other actions, or return the response in a format
specified. The header forcing download should be removed.

Try for yourself:
http://en.wikipedia.org/w/api.php?action=opensearch&search=Te


Version: unspecified
Severity: enhancement

Details

Reference
bz9143

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:35 PM
bzimport set Reference to bz9143.
bzimport added a subscriber: Unknown Object (MLST).

OpenSearch implementation in api.php is just that - an implementation of the
OpenSearch standard, which specifies the behaviour you've identified.

WONTFIX.

ayg wrote:

From skimming the protocol it appears that any formatting is permitted for the response:

http://www.opensearch.org/Specifications/OpenSearch/1.1

No? The term "JSON" doesn't even appear in the spec.

josh.hight wrote:

OpenSearch has nothing to do with JSON, directly. That spec gives an example of
an RSS/Atom OpenSearch response, for example.

Any idea when this will get out of WONTFIX status?

lcarsdata wrote:

Generally WONTFIX means something will *never* be implemented.

robchur wrote:

(In reply to comment #4)

Generally WONTFIX means something will *never* be implemented.

This bug should not have been marked WONTFIX, however, per Simetrical in comment
2 - the developer closing the bug failed to read the documentation.

Please do not confuse the open search protocol (used by search engines + clients), and the specific suggestions type application/x-suggestions+json

That document does not define suggestions format. Google + Firefox & IE have been using it in the exact form as implemented by action=opensearch.

I think the biggest problem is the name -- this is not open search but open search suggestions action. (a bit too long for my taste though).

On the other hand, this action can be improved to allow for query history or any other features implemented. But first, the protocol will need to be defined, and i couldn't find anything specific yet.

Some References:

Mozila:
http://developer.mozilla.org/en/docs/index.php?title=Supporting_search_suggestions_in_search_plugins

Multiple formats discussion (includes an interesting idea for returning last user's queries together with the results):
http://lists.opensearch.org/pipermail/opensearch-discuss/2007-March/000059.html

Yahoo search suggest uses a format argument (they apparently are using a similar API interface model):
http://wiki.mozilla.org/Firefox2/L10n_Requirements#Yahoo_Search_Suggest