Working example with indexing and searching