Commit fb00ee25d4911661b489b9125331e11ba1c4587f
Exists in
master
and in
39 other branches
Merge branch 'master' of github.com:TracyWebTech/colab
Showing
5 changed files
with
64 additions
and
3 deletions
Show diff stats
fabfile.py
1 | 1 | ||
2 | - | ||
3 | from fabric.operations import put | 2 | from fabric.operations import put |
4 | from fabric.api import run, sudo, env | 3 | from fabric.api import run, sudo, env |
5 | from fabric.contrib.files import exists | 4 | from fabric.contrib.files import exists |
6 | from fabric.decorators import with_settings | 5 | from fabric.decorators import with_settings |
7 | -from fabric.context_managers import prefix, cd | 6 | +from fabric.context_managers import prefix, cd, settings |
8 | 7 | ||
9 | env.user = 'colab' # key depends on env | 8 | env.user = 'colab' # key depends on env |
10 | env.use_shell = False | 9 | env.use_shell = False |
@@ -100,6 +99,17 @@ def rebuild_index(age=None): | @@ -100,6 +99,17 @@ def rebuild_index(age=None): | ||
100 | 99 | ||
101 | 100 | ||
102 | @with_settings(user='vagrant') | 101 | @with_settings(user='vagrant') |
102 | +def build_solr_schema(): | ||
103 | + with cd('/vagrant/src/'), prefix(WORKON_COLAB): | ||
104 | + run('python manage.py build_solr_schema -f /tmp/schema.xml') | ||
105 | + | ||
106 | + with settings(user='colab'): | ||
107 | + run('cp /tmp/schema.xml ~/apache-solr-3.6.2/example/solr/conf/schema.xml') | ||
108 | + | ||
109 | + sudo('supervisorctl restart solr') | ||
110 | + | ||
111 | + | ||
112 | +@with_settings(user='vagrant') | ||
103 | def runserver(update_requirements=False): | 113 | def runserver(update_requirements=False): |
104 | env_created = mkvirtualenv() | 114 | env_created = mkvirtualenv() |
105 | 115 |
src/proxy/search_indexes.py
@@ -20,6 +20,7 @@ class WikiIndex(indexes.SearchIndex, indexes.Indexable): | @@ -20,6 +20,7 @@ class WikiIndex(indexes.SearchIndex, indexes.Indexable): | ||
20 | modified = indexes.DateTimeField(model_attr='modified', null=True) | 20 | modified = indexes.DateTimeField(model_attr='modified', null=True) |
21 | type = indexes.CharField() | 21 | type = indexes.CharField() |
22 | icon_name = indexes.CharField() | 22 | icon_name = indexes.CharField() |
23 | + author_username = indexes.CharField(null=True) | ||
23 | 24 | ||
24 | # trac extra fields | 25 | # trac extra fields |
25 | collaborators = indexes.CharField(model_attr='collaborators', null=True) | 26 | collaborators = indexes.CharField(model_attr='collaborators', null=True) |
@@ -36,6 +37,15 @@ class WikiIndex(indexes.SearchIndex, indexes.Indexable): | @@ -36,6 +37,15 @@ class WikiIndex(indexes.SearchIndex, indexes.Indexable): | ||
36 | return author.get_full_name() | 37 | return author.get_full_name() |
37 | return obj.author | 38 | return obj.author |
38 | 39 | ||
40 | + def prepare_author_username(self, obj): | ||
41 | + author = obj.get_author() | ||
42 | + if not author: | ||
43 | + return obj.author | ||
44 | + return u'{}\n{}'.format( | ||
45 | + author.get_full_name(), | ||
46 | + author.username, | ||
47 | + ) | ||
48 | + | ||
39 | def prepare_author_url(self, obj): | 49 | def prepare_author_url(self, obj): |
40 | author = obj.get_author() | 50 | author = obj.get_author() |
41 | if author: | 51 | if author: |
@@ -65,6 +75,7 @@ class TicketIndex(indexes.SearchIndex, indexes.Indexable): | @@ -65,6 +75,7 @@ class TicketIndex(indexes.SearchIndex, indexes.Indexable): | ||
65 | type = indexes.CharField() | 75 | type = indexes.CharField() |
66 | icon_name = indexes.CharField() | 76 | icon_name = indexes.CharField() |
67 | tag = indexes.CharField(model_attr='status', null=True) | 77 | tag = indexes.CharField(model_attr='status', null=True) |
78 | + author_username = indexes.CharField(null=True) | ||
68 | 79 | ||
69 | # trac extra fields | 80 | # trac extra fields |
70 | milestone = indexes.CharField(model_attr='milestone', null=True) | 81 | milestone = indexes.CharField(model_attr='milestone', null=True) |
@@ -86,6 +97,15 @@ class TicketIndex(indexes.SearchIndex, indexes.Indexable): | @@ -86,6 +97,15 @@ class TicketIndex(indexes.SearchIndex, indexes.Indexable): | ||
86 | return author.get_full_name() | 97 | return author.get_full_name() |
87 | return obj.author | 98 | return obj.author |
88 | 99 | ||
100 | + def prepare_author_username(self, obj): | ||
101 | + author = obj.get_author() | ||
102 | + if not author: | ||
103 | + return obj.author | ||
104 | + return u'{}\n{}'.format( | ||
105 | + author.get_full_name(), | ||
106 | + author.username, | ||
107 | + ) | ||
108 | + | ||
89 | def prepare_author_url(self, obj): | 109 | def prepare_author_url(self, obj): |
90 | author = obj.get_author() | 110 | author = obj.get_author() |
91 | if author: | 111 | if author: |
@@ -120,6 +140,7 @@ class RevisionIndex(indexes.SearchIndex, indexes.Indexable): | @@ -120,6 +140,7 @@ class RevisionIndex(indexes.SearchIndex, indexes.Indexable): | ||
120 | modified = indexes.DateTimeField(model_attr='created', null=True) | 140 | modified = indexes.DateTimeField(model_attr='created', null=True) |
121 | type = indexes.CharField() | 141 | type = indexes.CharField() |
122 | icon_name = indexes.CharField() | 142 | icon_name = indexes.CharField() |
143 | + author_username = indexes.CharField(null=True) | ||
123 | 144 | ||
124 | # trac extra fields | 145 | # trac extra fields |
125 | repository_name = indexes.CharField(model_attr='repository_name') | 146 | repository_name = indexes.CharField(model_attr='repository_name') |
@@ -137,6 +158,15 @@ class RevisionIndex(indexes.SearchIndex, indexes.Indexable): | @@ -137,6 +158,15 @@ class RevisionIndex(indexes.SearchIndex, indexes.Indexable): | ||
137 | return author.get_full_name() | 158 | return author.get_full_name() |
138 | return obj.author | 159 | return obj.author |
139 | 160 | ||
161 | + def prepare_author_username(self, obj): | ||
162 | + author = obj.get_author() | ||
163 | + if not author: | ||
164 | + return obj.author | ||
165 | + return u'{}\n{}'.format( | ||
166 | + author.get_full_name(), | ||
167 | + author.username, | ||
168 | + ) | ||
169 | + | ||
140 | def prepare_author_url(self, obj): | 170 | def prepare_author_url(self, obj): |
141 | author = obj.get_author() | 171 | author = obj.get_author() |
142 | if author: | 172 | if author: |
src/search/forms.py
@@ -62,7 +62,9 @@ class ColabSearchForm(SearchForm): | @@ -62,7 +62,9 @@ class ColabSearchForm(SearchForm): | ||
62 | sqs = sqs.order_by(*dict_order['fields']) | 62 | sqs = sqs.order_by(*dict_order['fields']) |
63 | 63 | ||
64 | if self.cleaned_data['author']: | 64 | if self.cleaned_data['author']: |
65 | - sqs = sqs.filter(author=self.cleaned_data['author']) | 65 | + sqs = sqs.filter( |
66 | + author_username__contains=self.cleaned_data['author'] | ||
67 | + ) | ||
66 | 68 | ||
67 | if self.cleaned_data['milestone']: | 69 | if self.cleaned_data['milestone']: |
68 | sqs = sqs.filter(milestone=self.cleaned_data['milestone']) | 70 | sqs = sqs.filter(milestone=self.cleaned_data['milestone']) |
src/super_archives/search_indexes.py
@@ -21,7 +21,9 @@ class ThreadIndex(indexes.SearchIndex, indexes.Indexable): | @@ -21,7 +21,9 @@ class ThreadIndex(indexes.SearchIndex, indexes.Indexable): | ||
21 | type = indexes.CharField() | 21 | type = indexes.CharField() |
22 | icon_name = indexes.CharField() | 22 | icon_name = indexes.CharField() |
23 | tag = indexes.CharField(model_attr='mailinglist__name') | 23 | tag = indexes.CharField(model_attr='mailinglist__name') |
24 | + collaborators = indexes.CharField(use_template=True) | ||
24 | 25 | ||
26 | + author_username = indexes.CharField(null=True) | ||
25 | mailinglist_url = indexes.CharField( | 27 | mailinglist_url = indexes.CharField( |
26 | model_attr='mailinglist__get_absolute_url' | 28 | model_attr='mailinglist__get_absolute_url' |
27 | ) | 29 | ) |
@@ -35,6 +37,16 @@ class ThreadIndex(indexes.SearchIndex, indexes.Indexable): | @@ -35,6 +37,16 @@ class ThreadIndex(indexes.SearchIndex, indexes.Indexable): | ||
35 | def prepare_author(self, obj): | 37 | def prepare_author(self, obj): |
36 | return obj.message_set.first().from_address.get_full_name() | 38 | return obj.message_set.first().from_address.get_full_name() |
37 | 39 | ||
40 | + def prepare_author_username(self, obj): | ||
41 | + from_address = obj.message_set.first().from_address | ||
42 | + if not from_address.user: | ||
43 | + return from_address.get_full_name() | ||
44 | + | ||
45 | + return u'{}\n{}'.format( | ||
46 | + from_address.get_full_name(), | ||
47 | + from_address.user.username, | ||
48 | + ) | ||
49 | + | ||
38 | def prepare_author_url(self, obj): | 50 | def prepare_author_url(self, obj): |
39 | first_message = obj.message_set.first() | 51 | first_message = obj.message_set.first() |
40 | if first_message.from_address.user: | 52 | if first_message.from_address.user: |
src/super_archives/templates/search/indexes/super_archives/thread_collaborators.txt
0 → 100644