diff --git a/orp/orp_search/legislation.py b/orp/orp_search/legislation.py index 521c880..3f65ce7 100644 --- a/orp/orp_search/legislation.py +++ b/orp/orp_search/legislation.py @@ -29,7 +29,7 @@ def search(self, config: SearchDocumentConfig): "lang": "en", "title": search_terms, "text": search_terms, - "results-count": 100, + "results-count": 20, } # Register namespaces @@ -137,12 +137,15 @@ def _extract_entries(root): all_entries += _extract_entries(root) morePages = int(page_data["morePages"]) - logger.info(f"legislation more pages: {morePages}") if morePages > 1: + logger.info(f"legislation more pages: {morePages}") + # Get remaining pages for page in range(2, morePages + 1): + params["page"] = page root, _ = _do_request() - all_entries.append(_extract_entries(root)) + results = _extract_entries(root) + all_entries += results logger.info(f"legislation total results: {len(all_entries)}") return all_entries diff --git a/orp/orp_search/views.py b/orp/orp_search/views.py index 8cc1a62..fc1881b 100644 --- a/orp/orp_search/views.py +++ b/orp/orp_search/views.py @@ -238,12 +238,6 @@ def search(request: HttpRequest) -> HttpResponse: search_results = public_gateway.search(config) # Legislation search - # If config.search_terms is empty then we don't need to - # search for legislation - if not config.search_terms or "" in config.search_terms: - logger.info("no search terms provided") - return render(request, template_name="orp.html", context=context) - if not config.document_types or "legislation" in config.document_types: logger.info("searching for legislation: %s", config.search_terms) legislation = Legislation()