Exemplo n.º 1
0
    def _generate_document_for_group(self, group, existing):
        fields = []    

        # fields are in the form of [name, value, isStored, isIndexed, isTokenized]
        fields.append(['karma', str(group.get_karma_score()).zfill(6), False, True, False])    
        fields.append(['g_name', group.display_name(), False, True, True])
        fields.append(['date', str(get_unix_timestamp(group.date)), False, True, False])    # index it so that we can sort by it        
        fields.append(['oid', self._encode_oid(group._p_oid), True, True, False])
        fields.append(['type', 'Group', True, True, True])                     

        # create the main text to index (description + group userid + name)
        text = "%s %s %s" % (group.description, group.get_user_id(), group.display_name())
        fields.append(['text', text, False, True, True])

        # create the preview text    
        preview = self._generate_preview_text(group.description)
        fields.append(['preview', preview, True, False, False])

        # send the document for indexing        
        self._queue_document(fields, existing)
Exemplo n.º 2
0
 def _is_not_member(self, group, user):
     assert not group.is_member(user)
     assert not user in group.get_member_list()
     assert not user.is_member_of_group(qon.base.get_usergroup_database().get_usergroup(group.get_user_id()))