当前位置: 首页>>代码示例>>Python>>正文


Python Member.search_member_from_document方法代码示例

本文整理汇总了Python中model.Member.search_member_from_document方法的典型用法代码示例。如果您正苦于以下问题:Python Member.search_member_from_document方法的具体用法?Python Member.search_member_from_document怎么用?Python Member.search_member_from_document使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model.Member的用法示例。


在下文中一共展示了Member.search_member_from_document方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: members_with_status

# 需要导入模块: from model import Member [as 别名]
# 或者: from model.Member import search_member_from_document [as 别名]
    def members_with_status(self, status_name):
        index = search.Index(name='members')
        results = index.search(query=search.Query('status:' + status_name, options=search.QueryOptions(limit=LIMIT)))

        ret = list()
        for document in results:
            ret.append(Member.search_member_from_document(document))
        return ret
开发者ID:,项目名称:,代码行数:10,代码来源:

示例2: get

# 需要导入模块: from model import Member [as 别名]
# 或者: from model.Member import search_member_from_document [as 别名]
    def get(self):
        template = JINJA_ENVIRONMENT.get_template('templates/members/member_list.html')
        countries = Country.all().order('order').fetch(LIMIT)
        statuses = Status.all().order('order').fetch(LIMIT)
        types = MemberType.all().order('order').fetch(LIMIT)

        # TODO: Make sensible
        query_string = ''
        current_search = self.request.get('search')
        query_string +=  current_search

        current_status = self.request.get('status')
        if current_status != '':
            if query_string != '':
                query_string += ' AND '
            query_string += 'status:' + current_status

        current_type = self.request.get('type')
        if current_type != '':
            if query_string != '':
                query_string += ' AND '
            query_string += 'type:'+ current_type

        current_country = self.request.get('country')
        if current_country and current_country != '':
            if query_string != '':
                query_string += ' AND '
            query_string += 'country:' + current_country

        index = search.Index(name='members')
        result = index.search(query=search.Query(query_string, options=search.QueryOptions(limit=LIMIT)))

        members = list()
        for document in result.results:
            members.append(Member.search_member_from_document(document))

        members = sorted(members, key=lambda x: x.number)

        current_status_name = current_status
        current_type_name = current_type

        total = memcache.get('member_count')
        if not total:
            total = 0

        data = {
            'countries': countries,
            'statuses': statuses,
            'types': types,
            'members': members,
            'current_status': current_status,
            'current_type': current_type,
            'current_search': current_search,
            'found': result.number_found,
            'shown': len(members),
            'total': total
        }
        self.response.write(template.render(data))
开发者ID:,项目名称:,代码行数:60,代码来源:


注:本文中的model.Member.search_member_from_document方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。