Hello, I'm preparing a search form to perform searches against the db
(Postgre ).

well, Imagine the form with a category field, and a words field.

My view is something similar to this:

def my_view( request ):
    items = a_model.objects.all()
    if request.GET:
       ...
       if form.is_valid():
           ...
           words = data['words'].split()
           for word in words:
               items = items.filter( title__icontains = word)
               items = items.filter( description__icontains = word)
           if data['category']:
               items = items.filter( category = data['category'] )

Well, I know that since full-text is not available, this way is quite
intensive for the db.This code, search the words in the title and the
description, and if the category is defined, refines the result to
that category, if not, all categories are shown. I have read in the
docs, that chaining filters doesn't hit the database. Is this a good
way of chaining filters or perhaps there is other more effective?

Is there any way I can see the final generated sql clause?

Thank you!

(I'm really looking forward to postgre 8.3 with full-text in the core)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to