summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdolfo Fitoria <adolfo.fitoria@gmail.com>2012-06-20 16:13:07 -0600
committerAdolfo Fitoria <adolfo.fitoria@gmail.com>2012-06-20 16:13:07 -0600
commit4460f4c19d49b51e1d23834625972955681805da (patch)
tree531c3f92bf2f18f12a4607a04fae8e4590ad18af
parentd237df28f59bf7753e1ab370a7e5bd4628add81d (diff)
downloadaskbot-4460f4c19d49b51e1d23834625972955681805da.tar.gz
askbot-4460f4c19d49b51e1d23834625972955681805da.tar.bz2
askbot-4460f4c19d49b51e1d23834625972955681805da.zip
partially fixed relevance bug, it still does not produces the very same results as postgres but it (kinda) works
-rw-r--r--askbot/models/question.py6
-rw-r--r--askbot/search/haystack/__init__.py1
2 files changed, 6 insertions, 1 deletions
diff --git a/askbot/models/question.py b/askbot/models/question.py
index 8861574a..e310e676 100644
--- a/askbot/models/question.py
+++ b/askbot/models/question.py
@@ -300,7 +300,11 @@ class ThreadManager(models.Manager):
}
orderby = QUESTION_ORDER_BY_MAP[search_state.sort]
- qs = qs.extra(order_by=[orderby])
+
+ if not (settings.ENABLE_HAYSTACK_SEARCH and orderby=='-relevance'):
+ #FIXME: this does not produces the very same results as postgres.
+ qs = qs.extra(order_by=[orderby])
+
# HACK: We add 'ordering_key' column as an alias and order by it, because when distict() is used,
# qs.extra(order_by=[orderby,]) is lost if only `orderby` column is from askbot_post!
diff --git a/askbot/search/haystack/__init__.py b/askbot/search/haystack/__init__.py
index ad48fad5..7927aa87 100644
--- a/askbot/search/haystack/__init__.py
+++ b/askbot/search/haystack/__init__.py
@@ -52,6 +52,7 @@ class AskbotSearchQuerySet(SearchQuerySet):
else:
id_list.append(r.pk)
elif r.model_name == model_klass._meta.object_name.lower():
+ #FIXME: add a highlight here?
id_list.append(r.pk)
return model_klass.objects.filter(id__in=set(id_list))