> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Interface: SpatialPartitionQuery<TableInfo, Field>

> A spatial range within one complete partition, which nearest can rank.

[server](https://docs.bijection.com/api/modules/server).SpatialPartitionQuery

A spatial range within one complete partition, which nearest can rank.

## Type parameters

| Name | Type |
| :- | :- |
| `TableInfo` | extends [`GenericTableInfo`](https://docs.bijection.com/api/modules/server#generictableinfo) |
| `Field` | extends `string` |

## Hierarchy

* [`SpatialQuery`](https://docs.bijection.com/api/interfaces/server.SpatialQuery)\<`TableInfo`>

  ↳ **`SpatialPartitionQuery`**

## Methods

### require

▸ **require**(`requirement`): [`SpatialPartitionQuery`](https://docs.bijection.com/api/interfaces/server.SpatialPartitionQuery)\<`TableInfo`, `Field`>

#### Parameters

| Name | Type |
| :- | :- |
| `requirement` | [`SourceReadRequirement`](https://docs.bijection.com/api/modules/server#sourcereadrequirement) |

#### Returns

[`SpatialPartitionQuery`](https://docs.bijection.com/api/interfaces/server.SpatialPartitionQuery)\<`TableInfo`, `Field`>

#### Inherited from

[SpatialQuery](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md).[require](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md#require)

***

### filter

▸ **filter**(`predicate`): [`SpatialPartitionQuery`](https://docs.bijection.com/api/interfaces/server.SpatialPartitionQuery)\<`TableInfo`, `Field`>

#### Parameters

| Name | Type |
| :- | :- |
| `predicate` | (`q`: [`FilterBuilder`](https://docs.bijection.com/api/interfaces/server.FilterBuilder)\<`TableInfo`>) => [`ExpressionOrValue`](https://docs.bijection.com/api/modules/server#expressionorvalue)\<`boolean`> |

#### Returns

[`SpatialPartitionQuery`](https://docs.bijection.com/api/interfaces/server.SpatialPartitionQuery)\<`TableInfo`, `Field`>

#### Inherited from

[SpatialQuery](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md).[filter](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md#filter)

***

### withBudget

▸ **withBudget**(`budget`): [`SpatialPartitionQuery`](https://docs.bijection.com/api/interfaces/server.SpatialPartitionQuery)\<`TableInfo`, `Field`>

#### Parameters

| Name | Type |
| :- | :- |
| `budget` | [`ReadBudget`](https://docs.bijection.com/api/modules/server#readbudget) |

#### Returns

[`SpatialPartitionQuery`](https://docs.bijection.com/api/interfaces/server.SpatialPartitionQuery)\<`TableInfo`, `Field`>

#### Inherited from

[SpatialQuery](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md).[withBudget](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md#withbudget)

***

### explain

▸ **explain**(): [`ReadPath`](https://docs.bijection.com/api/modules/server#readpath)

Inspect the structural plan without consuming the query or deciding authority.

#### Returns

[`ReadPath`](https://docs.bijection.com/api/modules/server#readpath)

#### Inherited from

[SpatialQuery](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md).[explain](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md#explain)

***

### collect

▸ **collect**(): `Promise`\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>\[]>

#### Returns

`Promise`\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>\[]>

#### Inherited from

[SpatialQuery](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md).[collect](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md#collect)

***

### take

▸ **take**(`n`): `Promise`\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>\[]>

#### Parameters

| Name | Type |
| :- | :- |
| `n` | `number` |

#### Returns

`Promise`\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>\[]>

#### Inherited from

[SpatialQuery](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md).[take](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md#take)

***

### first

▸ **first**(): `Promise`\<`null` | [`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>>

#### Returns

`Promise`\<`null` | [`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>>

#### Inherited from

[SpatialQuery](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md).[first](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md#first)

***

### unique

▸ **unique**(): `Promise`\<`null` | [`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>>

#### Returns

`Promise`\<`null` | [`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>>

#### Inherited from

[SpatialQuery](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md).[unique](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md#unique)

***

### paginate

▸ **paginate**(`options`): `Promise`\<[`PaginationResult`](https://docs.bijection.com/api/interfaces/server.PaginationResult)\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>>>

#### Parameters

| Name | Type |
| :- | :- |
| `options` | [`PaginationOptions`](https://docs.bijection.com/api/interfaces/server.PaginationOptions) |

#### Returns

`Promise`\<[`PaginationResult`](https://docs.bijection.com/api/interfaces/server.PaginationResult)\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>>>

#### Inherited from

[SpatialQuery](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md).[paginate](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md#paginate)

***

### readPage

▸ **readPage**(`options`): `Promise`\<[`QueryReadPage`](https://docs.bijection.com/api/modules/server#queryreadpage)\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>>>

#### Parameters

| Name | Type |
| :- | :- |
| `options` | [`PaginationOptions`](https://docs.bijection.com/api/interfaces/server.PaginationOptions) |

#### Returns

`Promise`\<[`QueryReadPage`](https://docs.bijection.com/api/modules/server#queryreadpage)\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>>>

#### Inherited from

[SpatialQuery](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md).[readPage](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md#readpage)

***

### iterate

▸ **iterate**(`options`): `AsyncIterableIterator`\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>, `any`, `any`>

#### Parameters

| Name | Type |
| :- | :- |
| `options` | `Object` |
| `options.prefetch` | `number` |

#### Returns

`AsyncIterableIterator`\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>, `any`, `any`>

#### Inherited from

[SpatialQuery](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md).[iterate](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md#iterate)

***

### aggregate

▸ **aggregate**\<`Measures`, `By`>(`measures`, `options?`): [`AggregateResult`](https://docs.bijection.com/api/modules/server#aggregateresult)\<`TableInfo`, `Measures`, `By`>

#### Type parameters

| Name | Type |
| :- | :- |
| `Measures` | extends [`AggregateMeasures`](https://docs.bijection.com/api/modules/server#aggregatemeasures)\<`TableInfo`> |
| `By` | extends `undefined` \| readonly [`DocumentFields`](https://docs.bijection.com/api/modules/server#documentfields)\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>>\[] = `undefined` |

#### Parameters

| Name | Type |
| :- | :- |
| `measures` | `Measures` |
| `options?` | `TableInfo` extends \{ `nativeSeries`: `true`  } ? `never` : \{ `by`: `By`  } |

#### Returns

[`AggregateResult`](https://docs.bijection.com/api/modules/server#aggregateresult)\<`TableInfo`, `Measures`, `By`>

#### Inherited from

[SpatialQuery](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md).[aggregate](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md#aggregate)

***

### collectWithDiagnostics

▸ **collectWithDiagnostics**(): `Promise`\<[`ReadReport`](https://docs.bijection.com/api/modules/server#readreport)\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>, [`ReadUsage`](https://docs.bijection.com/api/modules/server#readusage)>>

#### Returns

`Promise`\<[`ReadReport`](https://docs.bijection.com/api/modules/server#readreport)\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>, [`ReadUsage`](https://docs.bijection.com/api/modules/server#readusage)>>

#### Inherited from

[SpatialQuery](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md).[collectWithDiagnostics](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md#collectwithdiagnostics)

***

### takeWithDiagnostics

▸ **takeWithDiagnostics**(`n`): `Promise`\<[`ReadReport`](https://docs.bijection.com/api/modules/server#readreport)\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>, [`ReadUsage`](https://docs.bijection.com/api/modules/server#readusage)>>

#### Parameters

| Name | Type |
| :- | :- |
| `n` | `number` |

#### Returns

`Promise`\<[`ReadReport`](https://docs.bijection.com/api/modules/server#readreport)\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>, [`ReadUsage`](https://docs.bijection.com/api/modules/server#readusage)>>

#### Inherited from

[SpatialQuery](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md).[takeWithDiagnostics](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md#takewithdiagnostics)

***

### nearest

▸ **nearest**(`origin`, `...options`): [`NearestQuery`](https://docs.bijection.com/api/interfaces/server.NearestQuery)\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>>

Rank this range's eligible documents by distance. Filters apply before
ranking; consume the result with `take` or `first`.

#### Parameters

| Name | Type |
| :- | :- |
| `origin` | `Field` extends [`NearestField`](https://docs.bijection.com/api/modules/server#nearestfield)\<`TableInfo`> ? [`Point`](https://docs.bijection.com/api/modules/values#point) : `never` |
| `...options` | `Exclude`\<[`FieldTypeFromFieldPath`](https://docs.bijection.com/api/modules/server#fieldtypefromfieldpath)\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>, `Field`>, `null` \| `undefined`> extends [`Position`](https://docs.bijection.com/api/modules/values#position) ? \[options: NearestOptions\<TableInfo, Field>] : \[options?: NearestOptions\<TableInfo, Field>] |

#### Returns

[`NearestQuery`](https://docs.bijection.com/api/interfaces/server.NearestQuery)\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>>

***

### \[asyncIterator]

▸ **\[asyncIterator]**(): `AsyncIterator`\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>, `any`, `any`>

#### Returns

`AsyncIterator`\<[`DocumentByInfo`](https://docs.bijection.com/api/modules/server#documentbyinfo)\<`TableInfo`>, `any`, `any`>

#### Inherited from

[SpatialQuery](https://docs.bijection.com/api/interfaces/server.SpatialQuery.md).[\[asyncIterator\]](https://docs.bijection.com/api/interfaces/server.SpatialQuery#\[asynciterator])


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.