I am trying
def patients_search(request):
filters = ()
if request.user.default_country:
filters = ('country = ', request.user.default_country)
logging.info('filters: %s' % str(filters))
return show_search_results(request, models.Patient,
'search_index', filters = filters,
key_based_on_empty_query = True)
I get 1 hit for q='julio', who has country "Madagascar", but 0 hits for q='julio' if request.user.default_country = 'Madagascar', as confirmed by logging:
INFO 2010-01-02 21:36:04,015 views.py:317] filters: ('country = ', u'Madagascar')
Note that the query itself works with unicode (using a dev console):
>>> pq = models.Patient.all().filter('country =', u'Madagascar')
>>> print pq.count(1000)
186
How do I debug what is happening?
Dan
On Jan 3, 1:00 am, Dan Frankowski <dfran...@gmail.com> wrote:
> This works in production, but not development. It might be the re-indexing
> tasks, since they don't seem to execute automatically in the dev environment
> (despite what the docs say). In fact, I think that's it. Probably 'country'
> never made it to the relational index. That's a little confusing. Oh well.
That's right. You have to start the background tasks manually on the
development server. To do so you can open the development console and
execute the background tasks there.
Bye,
Thomas
> On Sat, Jan 2, 2010 at 4:16 PM, Dan Frankowski <dfran...@gmail.com> wrote:
> > To be more particular about the working filter outside of the search code:
>
> > >>> pq = models.Patient.all().filter('country =',
> > 'Madagascar').filter('name =', 'Raza Julio')
> > >>> print pq.count(1000)
> > 1
>
> > Dan
>