def prep_search_string(self, search_string, add_wildcards=False):
    """Prepares search string as a proper whoosh search string.

    Args:
      search_string (str): it prepares the search string and see if
      the lenght is correct.

    Optional Args:
        add_wildcards (bool): It runs a query for inexact queries.

    Raises:
      ValueError: When the search string does not have the appropriate
      lenght. This lenght may be changed in the config options.
    """

    s = search_string.strip()
    try:
      s = str(s)
    except:
      pass
    s = s.replace('*', '')

    if len(s) < self._pw.search_string_min_len:
      raise ValueError('Search string must have at least {} characters'
        .format(self._pw.search_string_min_len))
    if add_wildcards:
      s = '*{0}*'.format(re.sub('[\s]+', '* *', s))
    return s