Permalink
Browse files

Ignore empty results when creating the query string, fixes #522

  • Loading branch information...
1 parent 259274e commit 2d8d878e880ec66c8057084071e89afd6437562d @dlo dlo committed Mar 1, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 haystack/backends/__init__.py
View
5 haystack/backends/__init__.py
@@ -1,6 +1,9 @@
# -*- coding: utf-8 -*-
+
from copy import deepcopy
from time import time
+import operator
+
from django.conf import settings
from django.db.models import Q
from django.db.models.base import ModelBase
@@ -224,7 +227,7 @@ def as_query_string(self, query_fragment_callback):
result.append(query_fragment_callback(field, filter_type, value))
conn = ' %s ' % self.connector
- query_string = conn.join(result)
+ query_string = conn.join(filter(operator.truth, result))
if query_string:
if self.negated:

0 comments on commit 2d8d878

Please sign in to comment.