Use variables in the missing field from group by item


I have the following lucene Query :

ServiceName:$name OR idService:$name

because sometimes, in my datas, the ServiceName attribute is missing but is valued in the idService attribute (and I have to deal with).

I want to “group by” the results on the term field ServiceName, but the records which are missing this field are ignored.

I however can deal with them by puting a default value in the “Missing” field from the order by item.
But it seems that we can’t use variables, nor values from the result.

It would be great if I could give them the idService attribute value, so that they could be grouped as well with the others which are not missing the ServiceName attribute.

Thank you for your advices