How does a molecule search work by drawing in visual editor?
Usually, structure search is implemented using a graph model. For example, let's take cyclohexane. On screen this is a hexagon - but this is converted on the server to a simple atom/bond graph model of six carbons in a ring.

This graph can then be compared to all the molecules in the database by various means. For example, subgraph isomorphism or fingerprints or even SMILES string comparison.

As far as I know, ChemSpider allows a variety of searches - with/without hydrogens, substructure search, element fingerprints, and so on. Each of these is a whole question by themselves, so I'm not sure how useful an algorithm that covers them all would be.