Hi!
If the name of your tensor is JJ, you can try things like
Collect[ScreenDollarIndices[%], {JJ[__]}]
However, this will not work perfectly because the indices will be
different in the different terms.
The main problem is that you have free indices in your expression.
This makes it difficult to get the same indices on J for all
terms.
If you don't have any free indices you can use the almost
experimental function IndexCollect.
However, in your case with free indices it will not work
correctly.
With free indices I don't know if collecting tensors is
mathematically well defined due to the index structure.
However, just using Collect as above could help a bit.
You can also change the way ToCanonical is rearranging the indices
by setting the xSortPrecedence value for the tensor.
This affects the ordering of the factors used determine the
canonical index ordering.
For instance with
xSortPrecedence[JJ] ^= 150;
the tensor JJ is moved to the right and with
xSortPrecedence[JJ] ^= 50;
it is moved to the left.
You will not see this in the output of ToCanonical because
Mathematical automatically rearranges the orders of the factors.
However, it can affect the canonical ordering of the indices.
When you have set the xSortPrecedence value you can for instance
try this on your expression
Collect[ScreenDollarIndices[ToCanonical[SeparateMetric[g]@%,
UseMetricOnVBundle -> None]], {JJ[__]}]
This will not completely solve your problem, but you might get
slightly shorter expressions.
Regards
Thomas