pybool_ir.query.units#

Internal representations for parsing queries. These classes help with the conversion of raw queries into AST nodes and lucene queries.

Classes

QueryAtom(tokens)

Helper class for parsing queries that do not need any additional parsing, like term or phrase queries.

UnitAtom()

A unit is the base class that represents a single query atom.

class pybool_ir.query.units.QueryAtom(tokens)#

Bases: UnitAtom

Helper class for parsing queries that do not need any additional parsing, like term or phrase queries. For examples of other kinds of queries and how they might be implemented, take a look at the private classes from the pybool_ir.query.pubmed.parser module.

classmethod from_str(s: str) QueryAtom#

Convenience method for creating a QueryAtom from a string.

property query#

The query that is to be analyzed and then used to create a Lucene query.

property raw_query#

The underlying, printable query. This is often identical to the query property, but can be different for some query languages.

class pybool_ir.query.units.UnitAtom#

Bases: object

A unit is the base class that represents a single query atom. There can be different kinds of atomic queries, such as a date query or a term query. As such, this class is the parent class for all these kinds of atomic queries.

property analyzed_query: str#

The final, analyzed query that can be used to search with a Lucene index.

abstract property query: str#

The query that is to be analyzed and then used to create a Lucene query.

abstract property raw_query: str#

The underlying, printable query. This is often identical to the query property, but can be different for some query languages.