search icon indicating copy to clipboard operation
search copied to clipboard

`prep_value_for_filtering` method required

Open martinallison opened this issue 12 years ago • 0 comments

Using field.to_search_value(value) for converting values passed to .filter() because the value indexed by the search API isn't always the same as the value you'd use to filter that field. Dates are a good example:

import datetime
from google.appengine.api import search

i = Index(name='films')

fields = [search.TextField(name='title', value='Die Hard'),
    search.DateField(name='released', value=datetime.date(1989, 02, 03))]

d = search.Document(fields=fields)
i.add(d)

# The filter value for the TextField is the same type as its search API value, but
# the date field's value is different: a date for the indexed value but a string
# for filtering
i.search('title:"die" released = 1989-02-03')

martinallison avatar Jul 02 '12 19:07 martinallison