We study the formation of social ties among heteogeneous agents in a model where meetings are governed by agents' directed search. The aim is to shed light on the important issue of homophily (the tendency of agents to connect with others of the same type). The essential contribution of the model is to provide a basic microfoundation for the opportunity/meeting biases that, as the literature highlights, are a crucial element of the phenomenon. Under the assumption that search is more effective in large pools, the equilibrium is characterized by a threshold in terms of group size: large groups only search among similar agents while smaller groups search in the whole population. This threshold behavior is consistent with the empirical evidenc...