parameters: (entity, query='', fields={},
            limit=None, offset=None, strict=False)
return_statement: return _do_mb_query(entity, '', [], params)
docstring: Perform a full-text search on the MusicBrainz search server.
      `query` is a lucene query string when no fields are set,
      but is escaped when any fields are given. `fields` is a dictionary
      of key/value query parameters. They keys in `fields` must be valid
      for the given entity type.
docstring_summary: Perform a full-text search on the MusicBrainz search server.
      `query` is a lucene query string when no fields are set,
      but is escaped when any fields are given. `fields` is a dictionary
      of key/value query parameters. They keys in `fields` must be valid
      for the given entity type.
docstring_tokens: Perform a full - text search on the MusicBrainz search server . query is a lucene query string when no fields are set but is escaped when any fields are given . fields is a dictionary of key / value query parameters . They keys in fields must be valid for the given entity type .
function: def _do_mb_search(entity, query='', fields={},
            limit=None, offset=None, strict=False):
      """Perform a full-text search on the MusicBrainz search server.
      `query` is a lucene query string when no fields are set,
      but is escaped when any fields are given. `fields` is a dictionary
      of key/value query parameters. They keys in `fields` must be valid
      for the given entity type.
      """
      # Encode the query terms as a Lucene query string.
      query_parts = []
      if query:
          clean_query = util._unicode(query)
          if fields:
              clean_query = re.sub(LUCENE_SPECIAL, r'\\\1',
                           clean_query)
              if strict:
                  query_parts.append('"%s"' % clean_query)
              else:
                  query_parts.append(clean_query.lower())
          else:
              query_parts.append(clean_query)
      for key, value in fields.items():
          # Ensure this is a valid search field.
          if key not in VALID_SEARCH_FIELDS[entity]:
              raise InvalidSearchFieldError(
                  '%s is not a valid search field for %s' % (key, entity)
              )
          elif key == "puid":
              warn("PUID support was removed from server\n"
                   "the 'puid' field is ignored",
                   Warning, stacklevel=2)
  
          # Escape Lucene's special characters.
          value = util._unicode(value)
          value = re.sub(LUCENE_SPECIAL, r'\\\1', value)
          if value:
              if strict:
                  query_parts.append('%s:"%s"' % (key, value))
              else:
                  value = value.lower() # avoid AND / OR
                  query_parts.append('%s:(%s)' % (key, value))
      if strict:
          full_query = ' AND '.join(query_parts).strip()
      else:
          full_query = ' '.join(query_parts).strip()
  
      if not full_query:
          raise ValueError('at least one query term is required')
  
      # Additional parameters to the search.
      params = {'query': full_query}
      if limit:
          params['limit'] = str(limit)
      if offset:
          params['offset'] = str(offset)
  
      return _do_mb_query(entity, '', [], params)
function_tokens: def _do_mb_search ( entity , query = '' , fields = { } , limit = None , offset = None , strict = False ) : # Encode the query terms as a Lucene query string. query_parts = [ ] if query : clean_query = util . _unicode ( query ) if fields : clean_query = re . sub ( LUCENE_SPECIAL , r'\\\1' , clean_query ) if strict : query_parts . append ( '"%s"' % clean_query ) else : query_parts . append ( clean_query . lower ( ) ) else : query_parts . append ( clean_query ) for key , value in fields . items ( ) : # Ensure this is a valid search field. if key not in VALID_SEARCH_FIELDS [ entity ] : raise InvalidSearchFieldError ( '%s is not a valid search field for %s' % ( key , entity ) ) elif key == "puid" : warn ( "PUID support was removed from server\n" "the 'puid' field is ignored" , Warning , stacklevel = 2 ) # Escape Lucene's special characters. value = util . _unicode ( value ) value = re . sub ( LUCENE_SPECIAL , r'\\\1' , value ) if value : if strict : query_parts . append ( '%s:"%s"' % ( key , value ) ) else : value = value . lower ( ) # avoid AND / OR query_parts . append ( '%s:(%s)' % ( key , value ) ) if strict : full_query = ' AND ' . join ( query_parts ) . strip ( ) else : full_query = ' ' . join ( query_parts ) . strip ( ) if not full_query : raise ValueError ( 'at least one query term is required' ) # Additional parameters to the search. params = { 'query' : full_query } if limit : params [ 'limit' ] = str ( limit ) if offset : params [ 'offset' ] = str ( offset ) return _do_mb_query ( entity , '' , [ ] , params )