search.services.index.authors module

Query-builders and helpers for searching by author name.

search.services.index.authors.Q_(qtype, field, value)[source]

Generate an appropriate Q based on wildcard presence.

Return type:<function Q at 0x7f5f70230510>
search.services.index.authors.author_id_query(term, operator='and')[source]

Generate a query part for Author ID using the ES DSL.

Return type:<function Q at 0x7f5f70230510>
search.services.index.authors.author_query(term, operator='and')[source]

Construct a query based on author (and owner) names.

Substrings delimited by semicolons should only match if the terms in that substring match within a single author.

If a substring (delimited or not) contains a comma, everything before the first comma will be treated as a surname, and the remainder treated as either the forename or initials. In this scenario, all terms must match within a single author.

Otherwise, we will simply match all of the parts of the query across all of the available author/owner fields. Each part of the query must match in at least one field in at least one author/owner.

Parameters:
  • term (str) – Raw querystring. Should not be escaped or normalized in any way.
  • operator (str) – Default: ‘AND’; anything else treated as ‘OR’. If ‘OR’, relaxes the requirement that all parts of the query match. This is useful for “all fields” searches, in which only part of the query may be expected to match on an author/owner name.
Returns:

An Elasticsearch DSL query part.

Return type:

Q

Return type:

<function Q at 0x7f5f70230510>

search.services.index.authors.orcid_query(term, operator='and')[source]

Generate a query part for ORCID ID using the ES DSL.

Return type:<function Q at 0x7f5f70230510>
search.services.index.authors.part_query(term, path='authors')[source]

Build a query that matches within a single author using name parts.

Anything before the first comma is treated as the author’s surname, and everything after the first comma is treated as the author’s first name or initials.

Parameters:
  • term (str) – Search term for a single author.
  • path (str) – Nested document path.
Returns:

Return type:

Q

Return type:

<function Q at 0x7f5f70230510>

search.services.index.authors.string_query(term, path='authors', operator='AND')[source]

Build a query that handles query strings within a single author.

Return type:<function Q at 0x7f5f70230510>