def get_exploration_ids_matching_query(query_string, cursor=None):
 returned_exploration_ids = []
 search_cursor = cursor
 for _ in range(MAX_ITERATIONS):
  remaining_to_fetch = (feconf.SEARCH_RESULTS_PAGE_SIZE - len(returned_exploration_ids))
  (exp_ids, search_cursor) = search_explorations(query_string, remaining_to_fetch, cursor=search_cursor)
  invalid_exp_ids = []
  for (ind, model) in enumerate(exp_models.ExpSummaryModel.get_multi(exp_ids)):
   if (model is not None):
    returned_exploration_ids.append(exp_ids[ind])
   else:
    invalid_exp_ids.append(exp_ids[ind])
  if ((len(returned_exploration_ids) == feconf.SEARCH_RESULTS_PAGE_SIZE) or (search_cursor is None)):
   break
  else:
   logging.error(('Search index contains stale exploration ids: %s' % ', '.join(invalid_exp_ids)))
 if ((len(returned_exploration_ids) < feconf.SEARCH_RESULTS_PAGE_SIZE) and (search_cursor is not None)):
  logging.error(('Could not fulfill search request for query string %s; at least %s retries were needed.' % (query_string, MAX_ITERATIONS)))
 return (returned_exploration_ids, search_cursor)

def get_exploration_ids_matching_query ( query_string , cursor = None ) : returned_exploration_ids = [ ] search_cursor = cursor for _ in range ( MAX_ITERATIONS ) : remaining_to_fetch = ( feconf . SEARCH_RESULTS_PAGE_SIZE - len ( returned_exploration_ids ) ) ( exp_ids , search_cursor ) = search_explorations ( query_string , remaining_to_fetch , cursor = search_cursor ) invalid_exp_ids = [ ] for ( ind , model ) in enumerate ( exp_models . ExpSummaryModel . get_multi ( exp_ids ) ) : if ( model is not None ) : returned_exploration_ids . append ( exp_ids [ ind ] ) else : invalid_exp_ids . append ( exp_ids [ ind ] ) if ( ( len ( returned_exploration_ids ) == feconf . SEARCH_RESULTS_PAGE_SIZE ) or ( search_cursor is None ) ) : break else : logging . error ( ( 'Search index contains stale exploration ids: %s' % ', ' . join ( invalid_exp_ids ) ) ) if ( ( len ( returned_exploration_ids ) < feconf . SEARCH_RESULTS_PAGE_SIZE ) and ( search_cursor is not None ) ) : logging . error ( ( 'Could not fulfill search request for query string %s; at least %s retries were needed.' % ( query_string , MAX_ITERATIONS ) ) ) return ( returned_exploration_ids , search_cursor )
returns a list with all exploration ids matching the given search query string .