# OESubSearchQuery¶

Attention

This is a preliminary API until Fall 2020 and may be improved based on user feedback. It is currently available in C++ and Python.

class OESubSearchQuery


The OESubSearchQuery class is used to submit queries to be searched in a database (OESubSearchDatabase).

Code Example

## Constructors¶

OESubSearchQuery(const OEQMolBase &query, const size_t maxmatches=1000u)


Creates an OESubSearchQuery object.

query
The query molecule (OEQMolBase).
maxmatches
The maximum number of matches that will be kept.

## SetFilter¶

void SetFilter(const OESystem::OEUnaryPredicate<OEMolBase>&)


Sets a molecule predicate that can be used to filter out molecules based on molecular properties other than the existence of a certain substructure.

Note

During the search, the predicate set by the OESubSearchQuery.SetFilter method is utilized after the screening phase and before the atom-by-atom validation of the substructure search match. Note that to minimize the memory footprints, the OESubSearchDatabase only stores the molecular graphs (no coordinates) and the titles of the molecules.

## GetMaxMatches¶

size_t GetMaxMatches() const


Returns the maximum match limit when searching OESubSearchDatabase. The OESubSearchDatabase.GetMatchIndices and OESubSearchDatabase.GetMatchTitles methods will terminate when this limit is reached. The default is 1000.

## SetMaxMatches¶

void SetMaxMatches(const size_t limit)


Sets the maximum match limit.

Note

While there is no upper limit on how many matches can be retrieve by the search, it is not recommended to set this limit very high (>10K). Searching a very large database with a very generic query can result in internally storing millions of indices or titles. The total number of matches can be determined (without storing all matches) either using the OESubSearchDatabase.NumMatches method or via the OESubSearchResult.NumTotalMatches counter when using the OESubSearchDatabase.Search method.