Added helper function to query the index database.