zotero / translation-server

A Node.js-based server to run Zotero translators
Other
122 stars 51 forks source link

Support 'format' parameter for /web and /search #58

Open dstillman opened 5 years ago

dstillman commented 5 years ago

Requested in https://github.com/zotero/translation-server/issues/51#issuecomment-439190808

The main problem with this is that if there are no results, the export translators could fail or produce something unexpected. Generally there either should be results or it should return a 501 (e.g., if we don't recognize an identifier), but at least when text search is enabled (which we use internally for ZoteroBib, but isn't used elsewhere) a text search can result in a 200 with no results. So I'm not sure what we would do in that case, but if we're not using this parameter that could probably stay undefined. We'd need to verify that there aren't other cases (web translation that doesn't throw an error but also doesn't return results?) where an empty array could be returned.

dhimmel commented 5 years ago

Thanks @dstillman for following up.

It sounds like it would be fine to explicitly not support the combination of text search AND format. This feature could always be added later.

Another thought is that some of the output formats like CSL JSON do support 0 or more results. So in the case where someone wanted a text search returned as CSL JSON and there are no results, I'd expect an empty array to be returned. Not sure how many of the other formats support 0 citations.