'Provides a mechanism for sanitizing user input before presenting the
value to the backend.
Whoosh 1.X differs here in that you can no longer use a backslash
to escape reserved characters. Instead, the whole word should be
quoted.'

def clean(self, query_fragment):

    words = query_fragment.split()
    cleaned_words = []
    for word in words:
        if (word in self.backend.RESERVED_WORDS):
            word = word.replace(word, word.lower())
        for char in self.backend.RESERVED_CHARACTERS:
            if (char in word):
                word = (u"'%s'" % word)
                break
        cleaned_words.append(word)
    return u'    '.join(cleaned_words)
