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


Python Query.count方法代码示例

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


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

示例1: refine_scan_action_estimates

# 需要导入模块: from query import Query [as 别名]
# 或者: from query.Query import count [as 别名]
def refine_scan_action_estimates():
  # FIXME: Should also check last SERPs of all queries (no clicks after page switch -> no record of scans)
  queries_count = Query.count()
  every_tenth = int(queries_count / 10)
  sys.stdout.write("Refining scan action estimates for %i queries..." % queries_count)
  current_queries_count = 0
  for session in Session.all():
    for query in session.sorted_queries():
      current_queries_count += 1
      sys.stdout.write('.')
      if current_queries_count % every_tenth == 0:
        sys.stdout.write('-' + str(current_queries_count) + '-')
      sys.stdout.flush()
      # First page examined but nothing clicked -> no record of scanned snippets
      # Estimate scans by looking at total scanning time, and comparing to average scanning time
      if len(query.document_read_actions()) == 0 and query.never_switched_from_first_serp():
        estimate_single_serp_query_scan_actions(query)
      elif query.no_document_actions_on_last_serp():
        estimate_last_serp_query_scan_actions(query)
  sys.stdout.write('\n')
开发者ID:fire-uta,项目名称:iiix-data-parser,代码行数:22,代码来源:parser.py

示例2: search

# 需要导入模块: from query import Query [as 别名]
# 或者: from query.Query import count [as 别名]
    def search(self, search_terms, page_size=25):
        """Perform a search and get back a results object
        """
        url = self.description.get_best_template()
        query = Query(url)

        # set up initial values
        query.searchTerms = search_terms
        query.count = page_size

        # run the results
        return Results(query, agent=self.agent)
开发者ID:kracekumar,项目名称:opensearch,代码行数:14,代码来源:client.py

示例3: search

# 需要导入模块: from query import Query [as 别名]
# 或者: from query.Query import count [as 别名]
    def search(self, search_terms, page_size=25, **kwargs):
        """Perform a search and get back a results object
        """
        url = self.description.get_best_template()
        query = Query(url)

        # set up initial values
        query.searchTerms = search_terms
        query.count = page_size

        # add any additional parameters to the query
        for name, value in kwargs.items():
            setattr(query, name, value)

        # run the results
        return Results(query, agent=self.agent)
开发者ID:FrankBlood,项目名称:opensearch,代码行数:18,代码来源:client.py

示例4: search

# 需要导入模块: from query import Query [as 别名]
# 或者: from query.Query import count [as 别名]
    def search(self, search_terms, template_type=None, template_rel=None, page_size=25, **kwargs):
        """Perform a search and get back a results object
        """
        if template_type is not None:
            if template_rel is not None:
                url = self.description.get_url_by_type_and_rel(template_type, template_rel).template
            else:
                url = self.description.get_url_by_type(template_type).template
        else:
            # If no type and rel has been given, then guess the best template to be used.
            url = self.description.get_best_template()

        query = Query(url)

        # set up initial values
        query.searchTerms = search_terms
        query.count = page_size

        # add any additional parameters to the query
        for name, value in kwargs.items():
            setattr(query, name, value)

        # run the results
        return Results(query, agent=self.agent)
开发者ID:jglouis,项目名称:opensearch,代码行数:26,代码来源:client.py


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