Commit 429877a99a3df66f4d9a98922e806aacdc88f7c4
1 parent
5990c9fb
Exists in
master
and in
39 other branches
Improving haystack boosts
Showing
2 changed files
with
9 additions
and
9 deletions
Show diff stats
src/proxy/search_indexes.py
@@ -40,10 +40,10 @@ class WikiIndex(indexes.SearchIndex, indexes.Indexable): | @@ -40,10 +40,10 @@ class WikiIndex(indexes.SearchIndex, indexes.Indexable): | ||
40 | 40 | ||
41 | def prepare(self, obj): | 41 | def prepare(self, obj): |
42 | data = super(WikiIndex, self).prepare(obj) | 42 | data = super(WikiIndex, self).prepare(obj) |
43 | - if obj.hits in [0, 1]: | 43 | + if obj.hits <= 10: |
44 | data['boost'] = 1 | 44 | data['boost'] = 1 |
45 | else: | 45 | else: |
46 | - data['boost'] = math.log(obj.hits, 2) | 46 | + data['boost'] = math.log(obj.hits) |
47 | return data | 47 | return data |
48 | 48 | ||
49 | def prepare_hits(self, obj): | 49 | def prepare_hits(self, obj): |
@@ -116,10 +116,10 @@ class TicketIndex(indexes.SearchIndex, indexes.Indexable): | @@ -116,10 +116,10 @@ class TicketIndex(indexes.SearchIndex, indexes.Indexable): | ||
116 | 116 | ||
117 | def prepare(self, obj): | 117 | def prepare(self, obj): |
118 | data = super(TicketIndex, self).prepare(obj) | 118 | data = super(TicketIndex, self).prepare(obj) |
119 | - if obj.hits in [0, 1]: | 119 | + if obj.hits <= 10: |
120 | data['boost'] = 1 | 120 | data['boost'] = 1 |
121 | else: | 121 | else: |
122 | - data['boost'] = math.log(obj.hits, 2) | 122 | + data['boost'] = math.log(obj.hits) |
123 | return data | 123 | return data |
124 | 124 | ||
125 | def prepare_hits(self, obj): | 125 | def prepare_hits(self, obj): |
@@ -191,10 +191,10 @@ class RevisionIndex(indexes.SearchIndex, indexes.Indexable): | @@ -191,10 +191,10 @@ class RevisionIndex(indexes.SearchIndex, indexes.Indexable): | ||
191 | 191 | ||
192 | def prepare(self, obj): | 192 | def prepare(self, obj): |
193 | data = super(RevisionIndex, self).prepare(obj) | 193 | data = super(RevisionIndex, self).prepare(obj) |
194 | - if obj.hits in [0, 1]: | ||
195 | - data['boost'] = 1 | 194 | + if obj.hits <= 10: |
195 | + data['boost'] = 0.8 | ||
196 | else: | 196 | else: |
197 | - data['boost'] = math.log(obj.hits, 2) | 197 | + data['boost'] = math.log(obj.hits) * 0.8 |
198 | return data | 198 | return data |
199 | 199 | ||
200 | def prepare_hits(self, obj): | 200 | def prepare_hits(self, obj): |
src/super_archives/search_indexes.py
@@ -47,10 +47,10 @@ class ThreadIndex(indexes.SearchIndex, indexes.Indexable): | @@ -47,10 +47,10 @@ class ThreadIndex(indexes.SearchIndex, indexes.Indexable): | ||
47 | 47 | ||
48 | def prepare(self, obj): | 48 | def prepare(self, obj): |
49 | data = super(ThreadIndex, self).prepare(obj) | 49 | data = super(ThreadIndex, self).prepare(obj) |
50 | - if obj.hits in [0, 1]: | 50 | + if obj.hits <= 10: |
51 | data['boost'] = 1 | 51 | data['boost'] = 1 |
52 | else: | 52 | else: |
53 | - data['boost'] = math.log(obj.hits, 2) | 53 | + data['boost'] = math.log(obj.hits) |
54 | return data | 54 | return data |
55 | 55 | ||
56 | def prepare_hits(self, obj): | 56 | def prepare_hits(self, obj): |