Using the GAE search API is it possible to search for a partial match?
I\'m trying to create autocomplete functionality where the term would be a partial word. eg.>
Jumping in very late here.
But here is my well documented function that does tokenizing. The docstring should help you understand it well and use it. Good luck!!!
def tokenize(string_to_tokenize, token_min_length=2):
"""Tokenizes a given string.
Note: If a word in the string to tokenize is less then
the minimum length of the token, then the word is added to the list
of tokens and skipped from further processing.
Avoids duplicate tokens by using a set to save the tokens.
Example usage:
tokens = tokenize('pack my box', 3)
Args:
string_to_tokenize: str, the string we need to tokenize.
Example: 'pack my box'.
min_length: int, the minimum length we want for a token.
Example: 3.
Returns:
set, containng the tokenized strings. Example: set(['box', 'pac', 'my',
'pack'])
"""
tokens = set()
token_min_length = token_min_length or 1
for word in string_to_tokenize.split(' '):
if len(word) <= token_min_length:
tokens.add(word)
else:
for i in range(token_min_length, len(word) + 1):
tokens.add(word[:i])
return tokens