In reply to Hishaam Namooya:
Thanks for your contribution. You were right, it was the resolution of the item ID that was causing the problem, but I wasn't keen on using session based persistence as it may cause problems if our editors have multiple tabs open.
I found read a blog written by Przemek Taront on reducing multsite chaos (http://www.cognifide.com/our-blogs/sitecore/reduce-multisite-chaos-with-sitecore-queries/). As the current context was available, even though it wasn't used, it made it easy to create my own pipleline:
public void Process(GetLookupSourceItemsArgs args)
{
if (args == null)
throw new ArgumentNullException(nameof(args));
if (!args.Source.StartsWith("query:"))
return;
var url = WebUtil.GetQueryString();
if (string.IsNullOrWhiteSpace(url) || !url.Contains("hdl")) return;
var parameters = FieldEditorOptions.Parse(new UrlString(url)).Parameters;
var currentItemId = parameters["contentitem"];
if (string.IsNullOrEmpty(currentItemId)) return;
var contentItemUri = new Sitecore.Data.ItemUri(currentItemId);
args.Item = Sitecore.Data.Database.GetItem(contentItemUri);
}
And in the config:
<processor patch:before="*[@type='Sitecore.Pipelines.GetLookupSourceItems.ProcessQuerySource, Sitecore.Kernel']"
type="MyType, MyAssemblyName" />