Commit 34151e9b authored by Michal Čihař's avatar Michal Čihař

Do not use weights for search, we ignore them anyway

parent a6a9bb88
......@@ -219,6 +219,8 @@ class UnitManager(models.Manager):
if rows == ([], []):
return self.none()
return self.filter(pk__in = [row[0] for row in rows])
# apply the weights to each row
weights = [(w, weight_fn(rows)) for w, weight_fn in settings.SEARCH_WEIGHTS]
......@@ -228,7 +230,6 @@ class UnitManager(models.Manager):
for document in total_scores:
total_scores[document] += weight * scores[document]
return self.filter(pk__in = total_scores.keys())
# sort by the calculated weights and return
# return sorted([(Unit.objects.get(pk = doc), score) for (doc, score) in total_scores.iteritems()], reverse=1)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment