Zum Inhalt

solr

dsstools.solr

This module enables interaction with our Solr instance.

Copyright (C) 2024 dssTools Developers David Seseke david.seseke@uni-hamburg.de Katherine Shay katherine.shay@studium.uni-hamburg.de Professur Digitale Sozialwissenschaften Universität Hamburg

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Solr

Class wrapping easy access to the Solr server.

_(domains, terms, **kwargs)

Searches the given keywords across a list.

query_multiple(domains, terms, **kwargs)

Searches the given keywords across a DiGraph or iterator.

Parameters:

Name Type Description Default
domains DiGraph | list

Set of identifiers to search in.

required
terms list[str]

Terms to search for.

required
kwargs

Are passed onto the internal query_single function.

{}

Returns:

Type Description

Updated graph or dict containing the responses, Set of all failed

responses

query_single(domain, terms, literal_terms=False)

Query a single domain for multiple terms.

Parameters:

Name Type Description Default
domain str

str: Domain to query.

required
terms List[str]

list[str]: Terms to query for.

required
literal_terms bool

Toggle for literal matching of search terms. The default setup will try to be smart about requested terms like escaping spaces. Setting this to True will allow for passing literal queries to Solr like regex queries. If you are a starter, leave this at default.

False

Returns:

Name Type Description
self dict[str, int] | None

Dictionary with the raw response counter keyed by term. If a list of list is given, the first value becomes the key.