On 13 Lis, 20:58, Info Cascade <[email protected]> wrote:
> art_list = Article.objects.filter(status__status='PUBLISHED',
> QExtra(where=['title_tsv @@ plainto_tsquery(%s)'],
> params=[term])) |
> Q(tags__name__icontains=term)).distinct()
I'm not aware of any QExtra-like functionality (someone correct me
please if I'm wrong here),
but you can do two searches and manually merge the results in Python,
i.e.:
art_list_published = Article.objects.filter
(status__status='PUBLISHED')
art_list_results1 = art_list_published.extra(
where=['title_tsv @@ plainto_tsquery(%s)'], params=[term]))
art_list_results2 = art_list_published.filter
(tags__name__icontains=term)
art_list_results_merged = set(art_list_results1+art_list_results2)
- I'm not sure if set will work here (IMO it should), but it's trivial
to replace it with custom merge
--
Tomasz Zieliński
http://pyconsultant.eu
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
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=.