示例#1
0
 def items(self):
     temp_list = []
     for key, value in  super(CleverDict, self).items():
         if isinstance(value, CleverDict):
             temp_list.extend([('%s.%s' % (self._name, k), py_to_solr(v)) for k, v in value.items() if v])
         elif isinstance(value, list):
             temp_list.extend([('%s.%s' % (self._name, key), py_to_solr(v)) for v in value])
         else:
             temp_list.append(('%s.%s' % (self._name, key), py_to_solr(value)))
     return temp_list
示例#2
0
 def search_term(cls, key, value):
     """ 
     Default search term for signle value lookup
     """
     temp = []
     temp.append('(')
     temp.append(str(key))
     temp.append(':')
     temp.append(py_to_solr(value))
     if cls.boost:
         temp.append('^%s'%str(cls.boost))
     temp.append(')')
     return ''.join(temp)