Judge Amit P. Mehta ruled on Tuesday that Google must hand over some of its search data to rivals, in a landmark antitrust case.