| author | ymh <ymh.work@gmail.com> |
| Fri, 20 Jul 2012 12:40:08 +0200 | |
| changeset 716 | 31dc2726ca51 |
| parent 167 | fe00e7302efe |
| child 1190 | 129d45eec68c |
| permissions | -rw-r--r-- |
| 22 | 1 |
from django.conf import settings |
2 |
import uuid |
|
| 716 | 3 |
import ldt.indexation |
| 22 | 4 |
|
5 |
__BOOLEAN_DICT = { |
|
6 |
'false':False, |
|
7 |
'true':True, |
|
8 |
'0':False, |
|
9 |
'1':True, |
|
10 |
't': True, |
|
11 |
'f':False |
|
12 |
} |
|
13 |
||
14 |
def boolean_convert(bool): |
|
15 |
if bool is None: |
|
16 |
return False |
|
17 |
if bool is True or bool is False: |
|
18 |
return bool |
|
19 |
key = str(bool).lower() |
|
20 |
return __BOOLEAN_DICT.get(key, False) |
|
21 |
||
22 |
||
23 |
def generate_uuid(): |
|
24 |
return unicode(uuid.uuid1()) |
|
25 |
||
26 |
||
27 |
#def normalize_tags(list): |
|
28 |
# nlist=[] |
|
29 |
# for tag in list: |
|
30 |
# tag = tag.lower() |
|
31 |
# nlist.append(tag) |
|
32 |
# taglist = dict().fromkeys(nlist).keys() |
|
33 |
# |
|
34 |
# return taglist |
|
35 |
||
36 |
||
37 |
class TextSearch(object): |
|
38 |
||
39 |
def query(self, field, query): |
|
| 716 | 40 |
return ldt.indexation.get_result_text(field, query) |
| 22 | 41 |
|
|
167
fe00e7302efe
Change class and functions names to follow PEP8 formatting standards
verrierj
parents:
77
diff
changeset
|
42 |
def query_all(self, query): |
| 22 | 43 |
return self.query("all", query) |
44 |
||
45 |