When expression is A+B then operands are A and B. And select selects operand which has what you wanted. So if the expression is t*u[1,1,1]*u[1,1,1,2]+2 then A=t*u[1,1,1]*u[1,1,1,2] and B=2, that is why it returned A.
When the input is t*u[1,1,1]*u[1,1,1,2] then expression is A*B*C and each one is now an operand. So A=t, B=u[1,1,1] and C=u[1,1,1,2] and that is why select now returned only u[1,1,1]
One way could be to do
LT:=proc(expr, term)
if type(expr,`+`) or nops(expr)=1 or expr=term then
select(has, expr, term);
elif type(expr,`*`) then
if has(expr,term) then
return expr;
else
return NULL;
fi;
else
error "not expression?";
fi;
end proc;
And now it works for both cases
