Add searchMemory function.