Commit 7128a979a1b68651beeda67a63ce5363f4cb6935
Committed by
Sergio Oliveira
1 parent
f80bb4a2
Exists in
master
and in
39 other branches
Haystack only indexes public threads
Signed-off-by: Gustavo Jaruga <darksshades@gmail.com> Signed-off-by: Alexandre Barbosa <alexandreab@live.com>
Showing
3 changed files
with
28 additions
and
2 deletions
Show diff stats
colab/super_archives/management/commands/import_emails.py
colab/super_archives/migrations/0002_mailinglist_is_private.py
0 → 100644
| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +from __future__ import unicode_literals | |
| 3 | + | |
| 4 | +from django.db import models, migrations | |
| 5 | + | |
| 6 | + | |
| 7 | +class Migration(migrations.Migration): | |
| 8 | + | |
| 9 | + dependencies = [ | |
| 10 | + ('super_archives', '0001_initial'), | |
| 11 | + ] | |
| 12 | + | |
| 13 | + operations = [ | |
| 14 | + migrations.AddField( | |
| 15 | + model_name='mailinglist', | |
| 16 | + name='is_private', | |
| 17 | + field=models.BooleanField(default=False), | |
| 18 | + preserve_default=True, | |
| 19 | + ), | |
| 20 | + ] | ... | ... |
colab/super_archives/search_indexes.py
| ... | ... | @@ -85,10 +85,12 @@ class ThreadIndex(BaseIndex, indexes.Indexable): |
| 85 | 85 | return u'thread' |
| 86 | 86 | |
| 87 | 87 | def index_queryset(self, using=None): |
| 88 | - return self.get_model().objects.filter( | |
| 89 | - spam=False | |
| 88 | + elements = self.get_model().objects.filter( | |
| 89 | + spam=False, mailinglist__is_private=False | |
| 90 | 90 | ).exclude(subject_token='') |
| 91 | 91 | |
| 92 | + return elements | |
| 93 | + | |
| 92 | 94 | def get_boost(self, obj): |
| 93 | 95 | boost = super(ThreadIndex, self).get_boost(obj) |
| 94 | 96 | ... | ... |