Well there is a way..
You could permutate the fields you would like to be able to partially
search and add that as a textfield. I use
def get_permutations(string):
newfragments = []
tokens = string.lower().split(' ')
tokens = list(set(tokens))
for token in tokens:
try:
token = unicode(token, 'utf-8')
except TypeError:
#logging.info(token)
for n in range(2, len(token) + 1):
if not n in newfragments:
newfragments.append(token[0:n].encode('utf-8'))
return newfragments
this splits up the string into tokens down to two letters per word, so
for example
"This is a property"
would become
"th thi this is pr pro prop prope proper propert property"
Seems to work great.. Im not quite sure how efficient this is but it
works..
On May 14, 11:50 pm, dennis <[email protected]> wrote:
> Have to admit I was very excited about this when I first saw the
> experimental release.
>
> Sadly I ran into a problem right away with partial word matching. Yes
> I know this is not supposed to work and I have code that executes
> datastore "starts with" queries when we get 0 results for a short
> single word query.
>
> The more interesting problem occurs at one fully matched word and a
> partial match on the second word of a query.
>
> Example:
> I have a document with a "name" field set to "foo bar" and about 999
> other documents with the "name" field set to "foo <any word that
> doesn't contain "bar" in it>"
>
> When I do a query for "foo ba" I get 0 results from the Search API.
> and when I do a query for "foo" I get 1000 results. Out of those 1000
> results I really want "foo bar" to be at the top but since it's only a
> partial match it can end up anywhere in the result set.
>
> The only way I've come up to get around this is do result merging that
> breaks up the query into individual words and if still not finding
> much then uses datastore "starts with" queries.
>
> If anyone has suggestions/ideas for other ways this can be implemented
> I'm all ears.
>
> - Dennis.
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.