code: def make_query(catalog):
      
      query = {}
      request = api.get_request()
      index = get_search_index_for(catalog)
      limit = request.form.get("limit")
  
      q = request.form.get("q")
      if len(q) > 0:
          query[index] = q + "*"
      else:
          return None
  
      portal_type = request.form.get("portal_type")
      if portal_type:
          if not isinstance(portal_type, list):
              portal_type = [portal_type]
          query["portal_type"] = portal_type
  
      if limit and limit.isdigit():
          query["sort_limit"] = int(limit)
  
      return query
docs: A function to prepare a query