Sort items Zotero offers to translator

I am using Better Bib(La)TeX to export collections to bib(la)tex. For some reason the ordering of the items in the exported bib file changes from time to time. How is that possible?

How can I ensure that the items are ordered (by whatever key) before they are offered to the translator? I don't care about the key by which the items are ordered, what is important is the that ordering stays the same.

Thank you very much!
  • That's not something Zotero can do, as the citation key is something BBT-specific.
  • Thank you for your reply. Actually, I was not referring to the citation key but any key that can be used for sorting.
    Would it be possible at all to sort the items before passing them on to BBT? Or let me ask differently: What determines the order in which the items are passed to BBT?
  • Ah, sorry, I should have read that more attentively. It should in principle be possible to just always order by itemID, which should be stable.

    As to the "why" (in the sense of "by what cause" moreso than "for what reason"), Zotero.Items._load doesn't have an "ORDER BY" in the SQL query. The underlying database is therefore free to choose any order to return the items in that it deems fastest/simplest to do/whatever is the most fun to code/etc. Demanding a specific order by using an ORDER BY usually impacts performance (it's one more thing the database must do before it can hand over the results), so it's usually omitted when not required.
  • OK, I understand. Now, the reason why I would like the items to be sorted is the following: when tracking the changes of a bib file (generated using BBT) with a version control system, the addition of a new item can result in a large change to the file.

    Would it greatly impact the performance of the query if the results were sorted? Could one leave it up to the translator to decide whether the items should to be sorted or not?
  • I can't really say -- On my limited library of 4000 items, there's no structural difference on the queries I've fired at it, but the Zotero devs will know best.
  • edited June 27, 2016
    There's no performance issue. Feel free to submit a patch against 5.0. (It wouldn't be for item loading, though. This would need to be specific to the items passed to the translator architecture.)
  • This should be fixed in the latest 4.0 Beta (Firefox only).
Sign In or Register to comment.