> news = News.objects.filter(
>     Q(title__icontains=phrase)
>   | Q(tags__icontains=phrase)
>   | Q(short__icontains=phrase)
>   | Q(content__icontains=phrase)
>   | Q(author__icontains=phrase)
>   | Q(source__icontains=phrase)
>  )
> 
> Does anybody know what can I do to fix that ?

A couple items/ideas:

1) to debug it, I'd start with the above statement with only one 
of the Q() objects and add them (or uncomment them) one at a time 
testing after each pass until the problem occured.  My suspicion 
lies with the TextField fields as I've used databases where the 
LIKE behaves a little funny with TEXT/MEMO fields.

2) it also might be the author which is a foreign key, which 
would mean you'd need something like

        Q(author__name__icontains=phrase)

where "name" is the field is the field of the author that you 
want to search.  To do this, you might need/want to also add a 
select_related() bit to your search, though I think Django is 
smart enough to add such tables in as needed.

3) if neither of those get you pointed in the right direction it 
might be helpful to know which DB backend you're using (the value 
of DATABASE_ENGINE from your settings.py)

Thinking about it, if I were a betting fellow, I'd go with #2

-tim




--~--~---------~--~----~------------~-------~--~----~
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