Re: Debugging search filters?

5 views
Skip to first unread message

Dan Frankowski

unread,
Jan 2, 2010, 5:16:35 PM1/2/10
to gae-search
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

On Sat, Jan 2, 2010 at 3:45 PM, Dan Frankowski <dfra...@gmail.com> wrote:
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




Dan Frankowski

unread,
Jan 2, 2010, 4:45:57 PM1/2/10
to gae-search

Dan Frankowski

unread,
Jan 2, 2010, 7:00:40 PM1/2/10
to gae-search
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.

Dan

twan...@googlemail.com

unread,
Jan 3, 2010, 11:22:07 AM1/3/10
to gae-search

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
>

Reply all
Reply to author
Forward
0 new messages