.. include:: ../../toolkit-substitutions

.. oe:namespace:: OEChem

.. oe:constnamespace:: OESubSearchDatabaseType

   .. attention::

      |TWOLANGUAGE|

   This namespace contains constants representing how search data
   (molecules and pre-generated screens) are stored and searched in an
   :ref:`OESubSearchDatabase <OEChem_OESubSearchDatabase>` object.

   This namespace contains the following constants.

   .. oe:constant:: Default

      The default type is :oe:const:`OEChem::OESubSearchDatabaseType::InMemoryMultiThreaded`.

   .. oe:constant:: InMemoryMultiThreaded

      When an :ref:`OESubSearchDatabase <OEChem_OESubSearchDatabase>` is initialized with the
      :oe:const:`OEChem::OESubSearchDatabaseType::InMemoryMultiThreaded` type,
      the search data, both molecules and pre-generated screens, are
      pre-loaded into memory.

      This mode is memory intensive, but it provides the **fastest** way to search a
      dataset when utilizing all available processors on the machine.

   .. oe:constant:: MolDatabaseMultiThreaded

      When an :ref:`OESubSearchDatabase <OEChem_OESubSearchDatabase>` is initialized with the
      :oe:const:`OEChem::OESubSearchDatabaseType::MolDatabaseMultiThreaded` type,
      **only** the pre-generated screens are pre-loaded into memory.
      During the search, if a molecule can not be rejected based on its screen, then
      it has to be loaded from disk on-the-fly to perform atom-by-atom validation.


      This mode is not as fast as
      :oe:const:`OEChem::OESubSearchDatabaseType::InMemoryMultiThreaded` mode, however,
      it requires significantly less memory, allowing to searches on larger datasets.
      The performance loss is highly dependent on the query and its screening performance.
      If a significantly large number of hits can be pre-screened, searching only a couple
      thousands molecules can be done very fast even with the added I/O cost of loading
      molecules on the fly.

   .. note::

      In both modes, searches can be executed in single or multi-treaded way
      based on the parameter (maximum number of processors) that was determined
      when the database was constructed.

   .. seealso::

      * :ref:`OESubSearchDatabase <OEChem_OESubSearchDatabase>` class

   .. admonition:: Code Example

      * :ref:`section_example_oechem_searchfastss` example
