def SIMPLE(val):
if not val:<EOL><INDENT>return None<EOL><DEDENT>if not isinstance(val, six.string_types):<EOL><INDENT>if six.PY3 and isinstance(val, bytes):<EOL><INDENT>val = val.decode('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>val = str(val)<EOL><DEDENT><DEDENT>return {'<STR_LIT>': _prefix_score(val)}<EOL>
This is a basic case-sensitive "sorted order" index keygen function for
strings. This will return a value that is suitable to be used for ordering
by a 7-byte prefix of a string (that is 7 characters from a byte-string, and
1.75-7 characters from a unicode string, depending on character -> encoding
length).

.. warning:: Case sensitivity is based on the (encoded) byte prefixes of the
    strings/text being indexed, so ordering *may be different* than a native
    comparison ordering (especially if an order is different based on
    characters past the 7th encoded byte).