Chemotactic bacteria rely on local concentration gradients to guide them towards the source of a nutrient. Such local cues pointing towards the location of the source are not always available at macroscopic scales because mixing in a flowing medium breaks up regions of high concentration into random and disconnected patches. Thus, animals sensing odours in air or water detect them only intermittently as patches sweep by on the wind or currents. A macroscopic searcher must devise a strategy of movement based on sporadic cues and partial information. Here we propose a search algorithm, which we call 'infotaxis', designed to work under such conditions. Any search process can be thought of as acquisition of information on source location; for infotaxis, information plays a role similar to concentration in chemotaxis. The infotaxis strategy locally maximizes the expected rate of information gain. We demonstrate its efficiency using a computational model of odour plume propagation and experimental data on mixing flows. Infotactic trajectories feature 'zigzagging' and 'casting' paths similar to those observed in the flight of moths. The proposed search algorithm is relevant to the design of olfactory robots, but the general idea of infotaxis can be applied more broadly in the context of searching with sparse information.