allura
Revision | 1db5cae9d7df90721d82b3afedcce36a4aa480a5 (tree) |
---|---|
Zeit | 2012-04-20 05:54:23 |
Autor | Cory Johns <johnsca@geek...> |
Commiter | Yaroslav Luzin |
[#4027] Fixed searching discussions and refactor 'deleted' field into Artifact
Signed-off-by: Cory Johns <johnsca@geek.net>
@@ -58,7 +58,7 @@ class SearchController(BaseController): | ||
58 | 58 | project_match = ' OR '.join( |
59 | 59 | 'project_id_s:%s' % pid |
60 | 60 | for pid in pids ) |
61 | - search_query = '%s AND is_history_b:%s AND (%s)' % ( | |
61 | + search_query = '%s AND is_history_b:%s AND (%s) AND -deleted_b:true' % ( | |
62 | 62 | q, history, project_match) |
63 | 63 | results = search.search(search_query, is_history_b=history) |
64 | 64 | if results: count=results.hits |
@@ -68,6 +68,7 @@ class Artifact(MappedClass): | ||
68 | 68 | app_config = RelationProperty('AppConfig') |
69 | 69 | # Not null if artifact originated from external import, then API ticket id |
70 | 70 | import_id = FieldProperty(str, if_missing=None) |
71 | + deleted=FieldProperty(bool, if_missing=False) | |
71 | 72 | |
72 | 73 | def __json__(self): |
73 | 74 | return dict( |
@@ -219,7 +220,8 @@ class Artifact(MappedClass): | ||
219 | 220 | url_s=self.url(), |
220 | 221 | type_s=self.type_s, |
221 | 222 | labels_t=' '.join(l for l in self.labels), |
222 | - snippet_s='') | |
223 | + snippet_s='', | |
224 | + deleted_b=self.deleted) | |
223 | 225 | |
224 | 226 | def url(self): |
225 | 227 | """ |
@@ -136,7 +136,7 @@ class RootController(BaseController): | ||
136 | 136 | 'is_history_b:%s' % history, |
137 | 137 | 'project_id_s:%s' % c.project._id, |
138 | 138 | 'mount_point_s:%s'% c.app.config.options.mount_point, |
139 | - 'deleted:false']) | |
139 | + '-deleted_b:true']) | |
140 | 140 | if results: count=results.hits |
141 | 141 | c.search_results = self.W.search_results |
142 | 142 | return dict(q=q, history=history, results=results or [], |
@@ -23,7 +23,6 @@ class Forum(M.Discussion): | ||
23 | 23 | parent_id = FieldProperty(schema.ObjectId, if_missing=None) |
24 | 24 | threads = RelationProperty('ForumThread') |
25 | 25 | posts = RelationProperty('ForumPost') |
26 | - deleted = FieldProperty(bool, if_missing=False) | |
27 | 26 | members_only = FieldProperty(bool, if_missing=False) |
28 | 27 | anon_posts = FieldProperty(bool, if_missing=False) |
29 | 28 | monitoring_email = FieldProperty(str, if_missing=None) |
@@ -76,7 +76,6 @@ class Page(VersionedArtifact): | ||
76 | 76 | title=FieldProperty(str) |
77 | 77 | text=FieldProperty(schema.String, if_missing='') |
78 | 78 | viewable_by=FieldProperty([str]) |
79 | - deleted=FieldProperty(bool, if_missing=False) | |
80 | 79 | type_s = 'Wiki' |
81 | 80 | |
82 | 81 | def commit(self): |
@@ -130,8 +129,7 @@ class Page(VersionedArtifact): | ||
130 | 129 | title_s='WikiPage %s' % self.title, |
131 | 130 | version_i=self.version, |
132 | 131 | type_s='WikiPage', |
133 | - text=self.text, | |
134 | - deleted_b=self.deleted) | |
132 | + text=self.text) | |
135 | 133 | return result |
136 | 134 | |
137 | 135 | @property |