# Class QueryService

Allows querying for features by SQL expression.

#### Hierarchy (view full)

- InitializableBase
  - QueryService

#####
Index

### Constructors

constructor

### Properties

_handles
@eventTypes
providers

### Accessors

failureMode
isDestroyed
isInitialized

### Methods

_getSerializableProperties
_initializableChildCollections
_initializeChildren
_onDestroy
_onInitialize
_postInitialize
_toPropertyDef
assignProperties
assignPropertiesAsync
count
destroy
finishAssignProperties
getDefault
getDefaults
getSerializableProperties
initialize
isSupported
query
toJSON

##
Constructors

### `Abstract` constructor

- new QueryService(...args): QueryService

- #### Parameters

  - `Rest`...args: [_properties?: InitializableBaseProperties]

  #### Returns QueryService

  Inherited from InitializableBase.constructor

##
Properties

### `Protected` `Readonly`_handles

_handles: Handles<unknown, ResourceHandle>

Inherited from InitializableBase._handles

### @eventTypes

@eventTypes: InitializableBaseEvents

#### Deprecated

Do not directly reference this property. Use EventNames and EventTypes helpers from @arcgis/core/Evented.

Inherited from InitializableBase.@eventTypes

### `Readonly` providers

providers: Collection<QueryProvider> = ...

Query providers that implement the query functionality. The collection will be populated with built-in Geocortex providers, however providers can be added or removed. The order is significant -- the first registered provider that is able to handle a given data/FeatureSource!FeatureSource will be used for that source (see tasks/query/QueryProvider!QueryProvider.isSupported).

##
Accessors

### failureMode

- get failureMode(): FailureMode

- Determines how a parent object should handle initialization failure in this object. The default is "warn".

  - `"error"`: support/InitializeError!InitializeError is thrown.
  - `"warn"`: Message is logged and support/InitializableBase!InitializeWarningEvent is raised.
  - `"ignore"`: support/InitializableBase!InitializeWarningEvent is raised.

  #### Returns FailureMode

  Inherited from InitializableBase.failureMode

- set failureMode(value): void

- #### Parameters

  - value: FailureMode

  #### Returns void

  Inherited from InitializableBase.failureMode

### isDestroyed

- get isDestroyed(): boolean

- See support/InitializableBase!Initializable.isDestroyed.

  #### Returns boolean

  Inherited from InitializableBase.isDestroyed

### isInitialized

- get isInitialized(): boolean

- See support/InitializableBase!Initializable.isInitialized.

  #### Returns boolean

  Inherited from InitializableBase.isInitialized

##
Methods

### `Protected`_getSerializableProperties

- _getSerializableProperties(): PropertyDefs<InitializableBaseProperties>

- The property keys and their metadata that are used to implement serializing and deserializing the class instance.

  #### Returns PropertyDefs<InitializableBaseProperties>

  Inherited from InitializableBase._getSerializableProperties

### `Protected`_initializableChildCollections

- _initializableChildCollections(): IterableIterator<Collection<InitializableBase<InitializableBaseProperties>>, any, any>

- Collections of child items to initialize. Items that fail to initialize are removed from the collection.

  #### Returns IterableIterator<Collection<InitializableBase<InitializableBaseProperties>>, any, any>

  Inherited from InitializableBase._initializableChildCollections

### `Protected`_initializeChildren

- _initializeChildren(): Promise<void>

- Initializes child entities.

  #### Returns Promise<void>

  Inherited from InitializableBase._initializeChildren

### `Protected`_onDestroy

- _onDestroy(): Promise<void>

- Called to perform cleanup. Subclasses should override this method rather than destroy() to perform custom cleanup.

  #### Returns Promise<void>

  Inherited from InitializableBase._onDestroy

### `Protected`_onInitialize

- _onInitialize(): Promise<void>

- Called to perform initialization of the support/InitializableBase!InitializableBase. Subclasses should override this method rather than initialize() to perform custom initialization.

  #### Returns Promise<void>

  Overrides InitializableBase._onInitialize

### `Protected`_postInitialize

- _postInitialize(): Promise<void>

- Called after normal initialization. Note: Child items are initialized before this is called.

  #### Returns Promise<void>

  Inherited from InitializableBase._postInitialize

### `Protected`_toPropertyDef

- _toPropertyDef<T>(def): PropertyDef<T>

- Converts the value to a PropertyDef object.

  #### Type Parameters

  - T

  #### Parameters

  - def: PropertyDefSerializeMode | PropertyDefSerializeMode[] | PropertyDef<T>

    The value to convert.

  #### Returns PropertyDef<T>

  Inherited from InitializableBase._toPropertyDef

### assignProperties

- assignProperties(properties): void

- #### Parameters

  - properties: Partial<InitializableBaseProperties>

  #### Returns void

  #### Inherit Doc

  Inherited from InitializableBase.assignProperties

### assignPropertiesAsync

- assignPropertiesAsync(properties): Promise<void>

- #### Parameters

  - properties: Partial<InitializableBaseProperties>

  #### Returns Promise<void>

  #### Inherit Doc

  Inherited from InitializableBase.assignPropertiesAsync

### count

- count(source, where, options?): Promise<CountResult>

- Counts the number of features that match the query criteria in a given feature source.

  #### Parameters

  - source: FeatureSource

    The source to search.

  - where: string

    An SQL expression to match against, e.g. "lastName='Smith'".

  - `Optional` options: QueryOptions

    Additional options that affect the query.

  #### Returns Promise<CountResult>

### destroy

- destroy(): Promise<void>

- A clean-up function that should get called whenever the item is disposed of.

  #### Returns Promise<void>

  Inherited from InitializableBase.destroy

### finishAssignProperties

- finishAssignProperties(): Promise<void>

- #### Returns Promise<void>

  #### Inherit Doc

  Inherited from InitializableBase.finishAssignProperties

### getDefault

- getDefault<K>(key): InitializableBaseProperties[K]

- #### Type Parameters

  - K extends "failureMode"

  #### Parameters

  - key: K

  #### Returns InitializableBaseProperties[K]

  #### Inherit Doc

  Inherited from InitializableBase.getDefault

### getDefaults

- getDefaults(): InitializableBaseProperties

- #### Returns InitializableBaseProperties

  #### Inherit Doc

  Inherited from InitializableBase.getDefaults

### getSerializableProperties

- getSerializableProperties(serializeMode?): PropertyDefs<InitializableBaseProperties>

- Returns the serializable properties.

  #### Parameters

  - `Optional` serializeMode: SerializeMode

    Optional. If specified, only properties that support the given serialization mode will be returned.

  #### Returns PropertyDefs<InitializableBaseProperties>

  Inherited from InitializableBase.getSerializableProperties

### initialize

- initialize(): Promise<void>

- Initializes the item.

  #### Returns Promise<void>

  Inherited from InitializableBase.initialize

### isSupported

- isSupported(source): boolean

- Determines whether this service is able to query the given source, i.e. whether there is at least one registered provider for that source.

  #### Parameters

  - source: FeatureSource

    The source to check.

  #### Returns boolean

### query

- query(queries): AsyncIterable<Feature, any, any>

- Queries the given feature sources provided in the query definitions for features that match the query criteria.

  #### Parameters

  - queries: QueryDefinition[]

    The queries to perform.

  #### Returns AsyncIterable<Feature, any, any>

- query(source, where, options?): AsyncIterable<Feature, any, any>

- Queries a given feature source for features that match the query criteria.

  #### Parameters

  - source: FeatureSource

    The source to query.

  - where: string

    An SQL expression to match against, e.g. "lastName='Smith'".

  - `Optional` options: QueryOptions

    Additional options that affect the query.

  #### Returns AsyncIterable<Feature, any, any>

### toJSON

- toJSON(serializeMode?): InitializableBaseProperties

- #### Parameters

  - serializeMode: SerializeMode = "all"

  #### Returns InitializableBaseProperties

  #### Inherit Doc

  Inherited from InitializableBase.toJSON