Currently, the available algorithms for unbiased structure searches are primarily atom-based, where atoms are manipulated as the elementary units, and energy is used as the target function without any restrictions on the bonding of atoms. In fact, in many cases such as nanostructure-assembled materials, the structural units are nanoclusters. We report a study of a bonding-restricted structure search method based on the particle swarm optimization (PSO) for finding the stable structures of two-dimensional (2D) materials containing dispersed C2 dimers rather than individual C atoms. The C2 dimer can be considered as a prototype of nanoclusters. Taking Si-C, B-C and Ti-C systems as test cases, our method combined with density functional theory and phonon calculations uncover new ground state geometrical structures for SiC2, Si2C2, BC2, B2C2, TiC2, and Ti2C2 sheets and their low-lying energy allotropes, as well as their electronic structures. Equally important, this method can be applied to other complex systems even containing f elements and other molecular dimers such as S2, N2, B2 and Si2, where the complex orbital orientations require extensive search for finding the optimal orientations to maximize the bonding with the dimers, predicting new 2D materials beyond MXenes (a family of transition metal carbides or nitrides) and dichalcogenide monolayers.