232 | | for bit in self.query.split(): |
233 | | or_queries = [models.Q(**{construct_search(str(field_name)): bit}) for field_name in self.search_fields] |
234 | | qs = qs.filter(reduce(operator.or_, or_queries)) |
| 232 | bits = self.query.split() |
| 233 | or_fields = [ f for f in self.search_fields if f[0] != '@' ] |
| 234 | ft_fields = [ f[1:] for f in self.search_fields if f[0] == '@' ] |
| 235 | if ft_fields: |
| 236 | match = ', '.join([ "`%s`.`%s`" % (self.opts.db_table, f) for f in ft_fields ]) |
| 237 | sql = 'MATCH (%s) AGAINST (%%s IN BOOLEAN MODE)' % match |
| 238 | qs = qs.extra(where=[sql], params=[self.query]) |
| 239 | for bit in bits: |
| 240 | or_queries = [ models.Q(**{construct_search(str(field_name)): bit}) |
| 241 | for field_name in or_fields ] |
| 242 | if or_queries: |
| 243 | qs = qs.filter(reduce(operator.or_, or_queries)) |