Commit 429877a99a3df66f4d9a98922e806aacdc88f7c4

Authored by Luan
1 parent 5990c9fb

Improving haystack boosts

src/proxy/search_indexes.py
... ... @@ -40,10 +40,10 @@ class WikiIndex(indexes.SearchIndex, indexes.Indexable):
40 40  
41 41 def prepare(self, obj):
42 42 data = super(WikiIndex, self).prepare(obj)
43   - if obj.hits in [0, 1]:
  43 + if obj.hits <= 10:
44 44 data['boost'] = 1
45 45 else:
46   - data['boost'] = math.log(obj.hits, 2)
  46 + data['boost'] = math.log(obj.hits)
47 47 return data
48 48  
49 49 def prepare_hits(self, obj):
... ... @@ -116,10 +116,10 @@ class TicketIndex(indexes.SearchIndex, indexes.Indexable):
116 116  
117 117 def prepare(self, obj):
118 118 data = super(TicketIndex, self).prepare(obj)
119   - if obj.hits in [0, 1]:
  119 + if obj.hits <= 10:
120 120 data['boost'] = 1
121 121 else:
122   - data['boost'] = math.log(obj.hits, 2)
  122 + data['boost'] = math.log(obj.hits)
123 123 return data
124 124  
125 125 def prepare_hits(self, obj):
... ... @@ -191,10 +191,10 @@ class RevisionIndex(indexes.SearchIndex, indexes.Indexable):
191 191  
192 192 def prepare(self, obj):
193 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 196 else:
197   - data['boost'] = math.log(obj.hits, 2)
  197 + data['boost'] = math.log(obj.hits) * 0.8
198 198 return data
199 199  
200 200 def prepare_hits(self, obj):
... ...
src/super_archives/search_indexes.py
... ... @@ -47,10 +47,10 @@ class ThreadIndex(indexes.SearchIndex, indexes.Indexable):
47 47  
48 48 def prepare(self, obj):
49 49 data = super(ThreadIndex, self).prepare(obj)
50   - if obj.hits in [0, 1]:
  50 + if obj.hits <= 10:
51 51 data['boost'] = 1
52 52 else:
53   - data['boost'] = math.log(obj.hits, 2)
  53 + data['boost'] = math.log(obj.hits)
54 54 return data
55 55  
56 56 def prepare_hits(self, obj):
... ...