Total Complexity | 2 |
Total Lines | 10 |
Duplicated Lines | 0 % |
1 | from functools import reduce |
||
8 | class SimpleSearch(object): |
||
9 | """ Simple ORM based search """ |
||
10 | |||
11 | def search(self, query_string): |
||
12 | """ Search all thread instances for the given query string """ |
||
13 | return models.Thread.objects.filter( |
||
14 | reduce( |
||
15 | lambda q, f: q & Q(title__icontains=f), |
||
16 | query_string.split(), |
||
17 | Q())) |
||
18 |