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 | 2 | from fabric.operations import put |
4 | 3 | from fabric.api import run, sudo, env |
5 | 4 | from fabric.contrib.files import exists |
6 | 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 | 8 | env.user = 'colab' # key depends on env |
10 | 9 | env.use_shell = False |
... | ... | @@ -100,6 +99,17 @@ def rebuild_index(age=None): |
100 | 99 | |
101 | 100 | |
102 | 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 | 113 | def runserver(update_requirements=False): |
104 | 114 | env_created = mkvirtualenv() |
105 | 115 | ... | ... |
src/proxy/search_indexes.py
... | ... | @@ -20,6 +20,7 @@ class WikiIndex(indexes.SearchIndex, indexes.Indexable): |
20 | 20 | modified = indexes.DateTimeField(model_attr='modified', null=True) |
21 | 21 | type = indexes.CharField() |
22 | 22 | icon_name = indexes.CharField() |
23 | + author_username = indexes.CharField(null=True) | |
23 | 24 | |
24 | 25 | # trac extra fields |
25 | 26 | collaborators = indexes.CharField(model_attr='collaborators', null=True) |
... | ... | @@ -36,6 +37,15 @@ class WikiIndex(indexes.SearchIndex, indexes.Indexable): |
36 | 37 | return author.get_full_name() |
37 | 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 | 49 | def prepare_author_url(self, obj): |
40 | 50 | author = obj.get_author() |
41 | 51 | if author: |
... | ... | @@ -65,6 +75,7 @@ class TicketIndex(indexes.SearchIndex, indexes.Indexable): |
65 | 75 | type = indexes.CharField() |
66 | 76 | icon_name = indexes.CharField() |
67 | 77 | tag = indexes.CharField(model_attr='status', null=True) |
78 | + author_username = indexes.CharField(null=True) | |
68 | 79 | |
69 | 80 | # trac extra fields |
70 | 81 | milestone = indexes.CharField(model_attr='milestone', null=True) |
... | ... | @@ -86,6 +97,15 @@ class TicketIndex(indexes.SearchIndex, indexes.Indexable): |
86 | 97 | return author.get_full_name() |
87 | 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 | 109 | def prepare_author_url(self, obj): |
90 | 110 | author = obj.get_author() |
91 | 111 | if author: |
... | ... | @@ -120,6 +140,7 @@ class RevisionIndex(indexes.SearchIndex, indexes.Indexable): |
120 | 140 | modified = indexes.DateTimeField(model_attr='created', null=True) |
121 | 141 | type = indexes.CharField() |
122 | 142 | icon_name = indexes.CharField() |
143 | + author_username = indexes.CharField(null=True) | |
123 | 144 | |
124 | 145 | # trac extra fields |
125 | 146 | repository_name = indexes.CharField(model_attr='repository_name') |
... | ... | @@ -137,6 +158,15 @@ class RevisionIndex(indexes.SearchIndex, indexes.Indexable): |
137 | 158 | return author.get_full_name() |
138 | 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 | 170 | def prepare_author_url(self, obj): |
141 | 171 | author = obj.get_author() |
142 | 172 | if author: | ... | ... |
src/search/forms.py
... | ... | @@ -62,7 +62,9 @@ class ColabSearchForm(SearchForm): |
62 | 62 | sqs = sqs.order_by(*dict_order['fields']) |
63 | 63 | |
64 | 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 | 69 | if self.cleaned_data['milestone']: |
68 | 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 | 21 | type = indexes.CharField() |
22 | 22 | icon_name = indexes.CharField() |
23 | 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 | 27 | mailinglist_url = indexes.CharField( |
26 | 28 | model_attr='mailinglist__get_absolute_url' |
27 | 29 | ) |
... | ... | @@ -35,6 +37,16 @@ class ThreadIndex(indexes.SearchIndex, indexes.Indexable): |
35 | 37 | def prepare_author(self, obj): |
36 | 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 | 50 | def prepare_author_url(self, obj): |
39 | 51 | first_message = obj.message_set.first() |
40 | 52 | if first_message.from_address.user: | ... | ... |
src/super_archives/templates/search/indexes/super_archives/thread_collaborators.txt
0 → 100644