def _execute_search(request, query, page_size): # Wildcards and exact url matches are specified in the url facet so set # separate_wildcard_uri_keys to False. search = Search(request, stats=request.stats, separate_wildcard_uri_keys=False) search.append_modifier(AuthorityFilter(authority=request.default_authority)) search.append_modifier(TopLevelAnnotationsFilter()) for agg in aggregations_for(query): search.append_aggregation(agg) query = query.copy() page = request.params.get("page", 1) try: page = int(page) except ValueError: page = 1 # Don't allow negative page numbers. if page < 1: page = 1 query["limit"] = page_size query["offset"] = (page - 1) * page_size search_result = search.run(query) return search_result
def _execute_search(request, query, page_size): # Wildcards and exact url matches are specified in the url facet so set # separate_wildcard_uri_keys to False. search = Search(request, stats=request.stats, separate_wildcard_uri_keys=False) search.append_modifier( AuthorityFilter(authority=request.default_authority)) search.append_modifier(TopLevelAnnotationsFilter()) for agg in aggregations_for(query): search.append_aggregation(agg) query = query.copy() page = request.params.get("page", 1) try: page = int(page) except ValueError: page = 1 # Don't allow negative page numbers. if page < 1: page = 1 query["limit"] = page_size query["offset"] = (page - 1) * page_size search_result = search.run(query) return search_result
def _execute_search(request, query, page_size): search = Search(request, stats=request.stats) search.append_modifier( AuthorityFilter(authority=request.default_authority)) search.append_modifier(TopLevelAnnotationsFilter()) if request.feature("wildcard_search_on_activity_pages"): search.append_modifier(UriCombinedWildcardFilter(request=request)) else: search.append_modifier(UriFilter(request=request)) for agg in aggregations_for(query): search.append_aggregation(agg) query = query.copy() page = request.params.get('page', 1) try: page = int(page) except ValueError: page = 1 # Don't allow negative page numbers. if page < 1: page = 1 query['limit'] = page_size query['offset'] = (page - 1) * page_size search_result = search.run(query) return search_result
def total_user_annotation_count(self, userid): """ Return the count of all annotations for this user. This disregards permissions, private/public, etc and returns the total number of annotations the user has made (including replies). """ params = MultiDict({"limit": 0, "user": userid}) search = Search(self.request, stats=self.request.stats) search.clear() search.append_modifier(Limiter()) search.append_modifier(DeletedFilter()) search.append_modifier(UserFilter()) search_result = search.run(params) return search_result.total
def total_user_annotation_count(self, userid): """ Return the count of all annotations for this user. This disregards permissions, private/public, etc and returns the total number of annotations the user has made (including replies). """ params = MultiDict({"limit": 0, "user": userid}) search = Search(self.request, stats=self.request.stats) search.clear() search.append_modifier(Limiter()) search.append_modifier(DeletedFilter()) search.append_modifier(UserFilter()) search_result = search.run(params) return search_result.total
def _search(self, params): search = Search(self.request, stats=self.request.stats) search.append_modifier(TopLevelAnnotationsFilter()) search_result = search.run(params) return search_result.total
def _search(self, params): search = Search(self.request, stats=self.request.stats) search.append_modifier(TopLevelAnnotationsFilter()) search_result = search.run(params) return search_result.total