erikrose/kitsune — comment on commit 09d0e886442c4a78ebf4e7fda7f38a4f4f786233
File: apps/questions/models.py line 500
By willkg:

That code sux0rz--my bad. It's better as:

question_search = (S(Question)
.weight(title=4, question_content=3, answer_content=3)
.group_by('question_id', '-@group')
.highlight(before_match='',
after_match='',
limit=settings.SEARCH_SUMMARY_LENGTH))

(Indentation sucks here--wish this comment form was monospaced.) The differences are that the after_match is wrong and also, this adds the weights.