@classmethod<EOL><INDENT>def prep_search_string(cls, search_string, match_substrings):<DEDENT>
if sys.version < '<STR_LIT:3>' and not isinstance(search_string, unicode):<EOL><INDENT>search_string = search_string.decode('<STR_LIT:utf-8>')<EOL><DEDENT>s = search_string.strip()<EOL>s = s.replace('<STR_LIT:*>', '<STR_LIT>')<EOL>if len(s) < _get_config(cls)['<STR_LIT>']:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if match_substrings:<EOL><INDENT>s = u'<STR_LIT>'.format(re.sub('<STR_LIT>', '<STR_LIT>', s))<EOL><DEDENT>return s<EOL>
Prepares search string as a proper whoosh search string.

        :param search_string: The search string which should be prepared.
        :param match_substrings: ``True`` if you want to match substrings,
                                 ``False`` otherwise.