What exactly do you mean by citation key? BibTeX key? If you aren’t already, you should install the BetterBibLaTex plugin to greatly enhance Zotero’s BibTeX functionality.
I don't think that's possible for technical reasons at this time because the citekey is generated & stored by the BetterBibTeX extension and not Zotero itself. It's likely going to be possible in the future.
Yes, the BBT developer had to disable citekey searching because it was interfering with other parts of Zotero. You can show the citekey as a column in the center pane and sort on that.
Citekey searching worked, but I couldn't limit it to collections. So if you have a collection selected and you search for a key, you would get matches from your entire library. The way Zotero search is set up, I cannot work around this. This will be fixed when Zotero gets a dedicated actual citekey field somewhere in the (hopefully not too far) future.
I've noticed that if I pin the bibtex citekey for my entire library, then I can search by citekey. Note that this can take some time to update a large library, and is reversed for unpinning.
That's correct, but that's because of a side effect; I have no way to store a permanent citekey other than to store it in the extra field, and you can search on the content of the extra field.
It can't be done without zotero changes, and those changes will likely come in the form of support for a zotero-native citekey field, which will solve the problem altogether.
Is there any update on the addition of a zotero-native citekey field? I would love to be able to have a links that lookup entries by their citekey's and return references in various convenient formats (apa etc). Right now we are creating a separate linking database to do this and it is not very reliable. Thanks!
I think perhaps this thread is referring to the gui interface (which works great for searching by citekey -- use that all the time) -- I specifically need it for the api so I can easily link from web pages to a specific paper by the semantically-relevant citekey.
I was about to ask for the same thing as the OP. Most of my citation keys are auto-generated thus I cannot search via the extra field. I would also rather not pin them (if I have understood correctly this would be a viable workaround).
I also wouldn't mind the mentioned non-limitation to selected (sub-)collections. It would primarily be a convenient way to find the papers for references I have put in latex files without remembering what it actually was :)
I'm still fiddling with a way to sneak in citekey search, but I find the search mechanism of Zotero a little hard to figure out. The UX of the old-style citekey search was really poor, the results were fairly confusing.
@emilianoheyns you are the Zorro of Zotero and if you can figure this one out, I will absolutely PayPal you a generous contribution for all your considerable efforts :)
Just to be clear, my particular use-case is *not* the "web view" (via a browser, interactively, on zotero.org) but rather for various web api calls where we want to be able to link into the Zotero database from e.g., a Hugo-generated website (e.g., https://ccnlab.org/pubs/ ) using the cite key, instead of the arbitrary zotero ID.
As a user, I *know* my cite keys and can just type those in, so it makes it so much easier, compared to having to have some kind of intermediary lookup process to find the arbitrary zotero ID. Seems like this could be useful for lots folks, whenever you want to refer to something in a web document?
It would also be great to use this for editor plugins -- I haven't really used them but I assume you can't just enter something like: \cite{CiteKey} and have that magically turn into a reference in a google doc or something, right? But with this lookup ability, that would be possible!
So, like the example I put above from Sept 13, it would be great to have some kind of api url with the citekey as the search term, that returns the corresponding item. Presumably, this would require mods to the actual server code running on zotero.org, so monkeypatches etc aren't going to work? But if a PR could be submitted, maybe @danstillman et al would accept it?
I also sent an email to this effect on the dev email list and got no response (other than from Emiliano), so I guess this isn't as straightforward, or as important, as it seems to me??
Technically doable? Yes... sort of. I can see a few problems (and there might be more) that might stand in the way of this being reliable:
if you use dynamic (non-pinned) keys, they don't sync to the Zotero server. They're strictly private to the local Zotero profile. You would have to pin all keys for this to work.
The Zotero item keys are unique across all user libraries, BBT citekeys are not, and they may not even be unique within one profile; if you sync multiple groups, you can have BBT generate unique keys scoped to either all synced items, or unique within each separate group/library only.
point one would be solved when Zotero gets a formal citation key field (which is planned). Point two need not be a problem but I could see why Zotero would prefer something that's guaranteed unique. A middle ground could be perhaps be found using search, assuming search on citekey becomes possible.
We have all our keys pinned, so that part is not a problem, and also just use one large shared group library.
But in any case, I was assuming it would be a search function -- could return 0 or multiple results and it is up to the caller to deal with the results.
The current api allows you to specify the group library to search etc, so it would be just a "simple" variation on this existing protocol:
So do you know whether it would be possible to search on a pinned citekey? In theory maybe that should be possible already? Any update on timing for having a formal citation key field?
I mean it won't work as-is, but technically it should be possible to parse out the pinned key.
But, ehm, I just realized. I think the product you refer to is the Zotero data server? If that's the case, there's several practical hurdles to overcome.
You'd have to run a private dataserver, which I see mentioned time and again is currently non-trivial to get to production state (although that info may be outdated)
I think you'd have to patch the clients to use that dataserver instead of the Zotero server (which does the sync, so this is a massive change in the user experience)
And last but for me certainly not least, the dataserver is written in PHP; I won't say "there's no amount of money you can pay me to touch PHP ever again", because that would be a lie, but it would be close enough for present purposes.
An alternate solution (not simple, mind), would be to use the Zotero API to sync item+extra to a private database an build a separate api on for citekey resolution, making querying on citekey a two-step process. Alternately, you could do a one-way sync from one of your desktops of the JSON file that holds the citekey-item connection and do the same.
I can't speak on the timeline for the citekey field. Obviously that would be the preferred solution all around, unless you find this important enough that I could retire comfortably after I touched the PHP code (including cost of living, sending two kids through college, and paying for a therapist who knows what working with PHP means to someone who thinks that Python still has some ugly inelegant bits in the language that engender mild disgust).
> An alternate solution (not simple, mind), would be to use the Zotero API to sync item+extra to a private database an build a separate api on for citekey resolution, making querying on citekey a two-step process.
This is exactly what we are currently doing. It is highly error-prone, and the machine that it runs on is being decommissioned. For that reason we also don't want to run a separate dataserver...
I'm really hoping that *someone* who is actually comfortable working with that PHP server can eventually allow it to search on citekey! I fully understand your discomfort :)
I search for not-pinned items: Field "Extra" not contains "Citation Key:"
This works because pinned keys in the extra field contain exactly this string. In the same way, you could add another search parameter that searches for another string in the "extra" field to find specific citekeys.
This works to find something that is unique to one entry in the title:
https://api.zotero.org/groups/340666/items/?q=Go-Explore&qmode=everything&itemQMode=contains&itemType=-attachment&format=json&include=citation&style=apa
Here is the citekey for that entry -- doesn't pull anything up:
https://api.zotero.org/groups/340666/items/?q=EcoffetHuizingaLehmanEtAl19&qmode=everything&itemQMode=contains&itemType=-attachment&format=json&include=citation&style=apa
I think perhaps this thread is referring to the gui interface (which works great for searching by citekey -- use that all the time) -- I specifically need it for the api so I can easily link from web pages to a specific paper by the semantically-relevant citekey.
I also wouldn't mind the mentioned non-limitation to selected (sub-)collections. It would primarily be a convenient way to find the papers for references I have put in latex files without remembering what it actually was :)
Just to be clear, my particular use-case is *not* the "web view" (via a browser, interactively, on zotero.org) but rather for various web api calls where we want to be able to link into the Zotero database from e.g., a Hugo-generated website (e.g., https://ccnlab.org/pubs/ ) using the cite key, instead of the arbitrary zotero ID.
As a user, I *know* my cite keys and can just type those in, so it makes it so much easier, compared to having to have some kind of intermediary lookup process to find the arbitrary zotero ID. Seems like this could be useful for lots folks, whenever you want to refer to something in a web document?
It would also be great to use this for editor plugins -- I haven't really used them but I assume you can't just enter something like: \cite{CiteKey} and have that magically turn into a reference in a google doc or something, right? But with this lookup ability, that would be possible!
So, like the example I put above from Sept 13, it would be great to have some kind of api url with the citekey as the search term, that returns the corresponding item. Presumably, this would require mods to the actual server code running on zotero.org, so monkeypatches etc aren't going to work? But if a PR could be submitted, maybe @danstillman et al would accept it?
I also sent an email to this effect on the dev email list and got no response (other than from Emiliano), so I guess this isn't as straightforward, or as important, as it seems to me??
Technically doable? Yes... sort of. I can see a few problems (and there might be more) that might stand in the way of this being reliable:
But in any case, I was assuming it would be a search function -- could return 0 or multiple results and it is up to the caller to deal with the results.
The current api allows you to specify the group library to search etc, so it would be just a "simple" variation on this existing protocol:
https://api.zotero.org/groups/340666/items/?q=Go-Explore&qmode=everything&itemQMode=contains&itemType=-attachment&format=json&include=citation&style=apa
So do you know whether it would be possible to search on a pinned citekey? In theory maybe that should be possible already? Any update on timing for having a formal citation key field?
But, ehm, I just realized. I think the product you refer to is the Zotero data server? If that's the case, there's several practical hurdles to overcome.
An alternate solution (not simple, mind), would be to use the Zotero API to sync item+extra to a private database an build a separate api on for citekey resolution, making querying on citekey a two-step process. Alternately, you could do a one-way sync from one of your desktops of the JSON file that holds the citekey-item connection and do the same.
I can't speak on the timeline for the citekey field. Obviously that would be the preferred solution all around, unless you find this important enough that I could retire comfortably after I touched the PHP code (including cost of living, sending two kids through college, and paying for a therapist who knows what working with PHP means to someone who thinks that Python still has some ugly inelegant bits in the language that engender mild disgust).This is exactly what we are currently doing. It is highly error-prone, and the machine that it runs on is being decommissioned. For that reason we also don't want to run a separate dataserver...
I'm really hoping that *someone* who is actually comfortable working with that PHP server can eventually allow it to search on citekey! I fully understand your discomfort :)
edit: aww booh, no image support on the forum.
<a href>
, or<img src>
?Field "Extra" not contains "Citation Key:"
This works because pinned keys in the extra field contain exactly this string. In the same way, you could add another search parameter that searches for another string in the "extra" field to find specific citekeys.
The start of a citekey could be done by search:
Field "Extra" contains "Citation Key: FOOBAR"