def search(self, query, method="<STR_LIT:all>"):
logging.debug('<STR_LIT>', self.name, query)<EOL>if not self._loaded:<EOL><INDENT>self.load(query)<EOL><DEDENT>if method == "<STR_LIT:all>":<EOL><INDENT>search_function = self._search_all<EOL><DEDENT>elif method == "<STR_LIT:name>":<EOL><INDENT>search_function = self._search_names<EOL><DEDENT>elif method == "<STR_LIT>":<EOL><INDENT>search_function = self._search_uid<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>return list(search_function(query))<EOL>
Search this address book for contacts matching the query.

        The method can be one of "all", "name" and "uid".  The backend for this
        address book migth be load()ed if needed.

        :param query: the query to search for
        :type query: str
        :param method: the type of fileds to use when seaching
        :type method: str
        :returns: all found contacts
        :rtype: list(carddav_object.CarddavObject)