clp_ffi_py.ir.query_builder module#

class clp_ffi_py.ir.query_builder.QueryBuilder[source]#

Bases: object

This class serves as an interface for conveniently constructing Query objects utilized in CLP IR streaming search. It provides methods for configuring and resetting search parameters.

For more details about the search query CLP IR stream supports, see Query and WildcardQuery.

add_wildcard_query(wildcard_query: WildcardQuery) QueryBuilder[source]#

Adds the given wildcard query to the wildcard query list.

Parameters:

wildcard_query (WildcardQuery) – The wildcard query object to add.

Returns:

self.

Return type:

QueryBuilder

add_wildcard_query(wildcard_query: str, case_sensitive: bool = False) QueryBuilder[source]

Constructs and adds a WildcardQuery to the wildcard query list.

Deprecated since version 0.0.12: Use add_wildcard_query() with either a FullStringWildcardQuery or SubstringWildcardQuery instead.

Parameters:
  • wildcard_query (str) – The wildcard query string to add.

  • case_sensitive (bool) – Whether to perform case-sensitive matching.

Returns:

self.

Return type:

QueryBuilder

add_wildcard_queries(wildcard_queries)[source]#

Adds a list of wildcard queries to the wildcard query list.

Parameters:

wildcard_queries (List[WildcardQuery]) – The list of wildcard queries to add.

Returns:

self.

Return type:

QueryBuilder

build()[source]#
Raises:

QueryBuilderException – If the search time range lower bound exceeds the search time range upper bound.

Returns:

A Query object initialized with the parameters set by the builder.

Return type:

Query

reset()[source]#

Resets all settings to their defaults.

Returns:

self.

Return type:

QueryBuilder

reset_search_time_lower_bound()[source]#

Resets the search time lower bound to the default value.

Returns:

self.

Return type:

QueryBuilder

reset_search_time_termination_margin()[source]#

Resets the search time termination margin to the default value.

Returns:

self.

Return type:

QueryBuilder

reset_search_time_upper_bound()[source]#

Resets the search time upper bound to the default value.

Returns:

self.

Return type:

QueryBuilder

reset_wildcard_queries()[source]#

Clears the wildcard query list.

Returns:

self.

Return type:

QueryBuilder

property search_time_lower_bound: int#
property search_time_termination_margin: int#
property search_time_upper_bound: int#
set_search_time_lower_bound(ts)[source]#
Parameters:

ts (int) – Start of the search time range (inclusive) as a UNIX epoch timestamp in milliseconds.

Returns:

self.

Return type:

QueryBuilder

set_search_time_termination_margin(ts)[source]#
Parameters:

ts (int) – The search time termination margin as a UNIX epoch timestamp in milliseconds.

Returns:

self.

Return type:

QueryBuilder

set_search_time_upper_bound(ts)[source]#
Parameters:

ts (int) – End of the search time range (inclusive) as a UNIX epoch timestamp in milliseconds.

Returns:

self.

Return type:

QueryBuilder

property wildcard_queries: List[WildcardQuery]#
Returns:

A deep copy of the underlying wildcard query list.

exception clp_ffi_py.ir.query_builder.QueryBuilderException[source]#

Bases: Exception

Exception raised when building a Query fails.