compass.web.search.search_single_jurisdiction#
- async search_single_jurisdiction(query_templates, jurisdiction, num_urls=5, browser_semaphore=None, url_ignore_substrings=None, url_keep_substrings=None, simple=True, **se_kwargs)[source]#
Search the web for relevant links and return a sorted output
- Parameters:
query_templates (
Iterableofstr) – Query templates to format with the jurisdiction name and search. Each template should include a{jurisdiction}placeholder for the jurisdiction name.jurisdiction (
Jurisdiction) – Jurisdiction instance representing the jurisdiction to search documents for.num_urls (
int, optional) – Number of unique search result URL’s to check for each jurisdiction. By default,5.browser_semaphore (
asyncio.Semaphore) – Semaphore instance that can be used to limit the number of playwright browsers used to submit search engine queries open concurrently. By default,None.url_ignore_substrings (
listofstr, optional) – URL substrings that should be excluded from search results. Substrings are applied case-insensitively. By default,None.url_keep_substrings (
listofstr, optional) – URL substrings that should be included in search results even if they match an ignore substring. Substrings are applied case-insensitively. By default,None.simple (
bool, optional) – Flag indicating whether to use a simple top-n sort from the first search engine that gives results (True) or to apply a holistic link sorting based on all results from all search engines (False). By default,True.**se_kwargs – Additional keyword arguments forwarded to
elm.web.search.run.web_search_links_as_docs(). Common entries includeusage_trackerfor logging LLM usage and extra Playwright configuration.
- Returns:
dict–Dictionary containing the following keys:
jurisdiction: Full jurisdiction namestate: Jurisdiction statecounty: Jurisdiction countysubdivision: Jurisdiction subdivision namequeries: List of formatted query strings that were searchedresults: List of search results dictionaries, with at least one key:"url", which contains the URL of the search result.