Conditions | 3 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
1 | from functools import reduce |
||
18 | def search(self, query_string): |
||
19 | """ Search all thread instances for the given query string """ |
||
20 | threads = models.Thread.objects.filter( |
||
21 | reduce( |
||
22 | lambda q, f: q & Q(title__icontains=f), |
||
23 | query_string.split(), |
||
24 | Q())) |
||
25 | |||
26 | result_set = SearchResultSet() |
||
27 | for thread in threads: |
||
28 | result_set.add(thread) |
||
29 | |||
30 | return result_set |
||
31 | |||
34 |