Skip to content

Commit 48337b1

Browse files
committed
[DE-569] Add geo_s2 Analyzer types
1 parent 02f00ee commit 48337b1

File tree

2 files changed

+70
-2
lines changed

2 files changed

+70
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ This driver uses semantic versioning:
3939

4040
These attributes were added in ArangoDB 3.10.4.
4141

42+
- Added `geo_s2` Analyzer types
43+
44+
This Analyzer was added in ArangoDB 3.10.5.
45+
4246
- Added `refillIndexCaches` option to document operation options types
4347

4448
This option was added in ArangoDB 3.11.

src/analyzer.ts

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ export type CreateAnalyzerOptions =
4646
| CreateClassificationAnalyzerOptions
4747
| CreateNearestNeighborsAnalyzerOptions
4848
| CreateGeoJsonAnalyzerOptions
49-
| CreateGeoPointAnalyzerOptions;
49+
| CreateGeoPointAnalyzerOptions
50+
| CreateGeoS2AnalyzerOptions;
5051

5152
/**
5253
* Options for creating an Identity Analyzer.
@@ -563,6 +564,54 @@ export type CreateGeoPointAnalyzerOptions = {
563564
};
564565
};
565566

567+
/**
568+
* (Enterprise Edition only.) Options for creating a Geo S2 Analyzer
569+
*/
570+
export type CreateGeoS2AnalyzerOptions = {
571+
/**
572+
* Type of the Analyzer.
573+
*/
574+
type: "geo_s2";
575+
/**
576+
* Features to enable for this Analyzer.
577+
*/
578+
features?: AnalyzerFeature[];
579+
/**
580+
* Additional properties for the Analyzer.
581+
*/
582+
properties: {
583+
/**
584+
* If set to `"centroid"`, only the centroid of the input geometry will be
585+
* computed and indexed.
586+
*
587+
* If set to `"point"` only GeoJSON objects of type Point will be indexed and
588+
* all other geometry types will be ignored.
589+
*
590+
* Default: `"shape"`
591+
*/
592+
type?: "shape" | "centroid" | "point";
593+
/**
594+
* Options for fine-tuning geo queries.
595+
*
596+
* Default: `{ maxCells: 20, minLevel: 4, maxLevel: 23 }`
597+
*/
598+
options?: { maxCells?: number; minLevel?: number; maxLevel?: number };
599+
/**
600+
* If set to `"latLngDouble"`, each latitude and longitude value is stored
601+
* as an 8-byte floating-point value (16 bytes per coordinate pair).
602+
*
603+
* If set to `"latLngInt"`, each latitude and longitude value is stored as
604+
* a 4-byte integer value (8 bytes per coordinate pair).
605+
*
606+
* If set to `"s2Point"`, each longitude-latitude pair is stored in the
607+
* native format of Google S2 (24 bytes per coordinate pair).
608+
*
609+
* Default: `"latLngDouble"`
610+
*/
611+
format?: "latLngDouble" | "latLngInt" | "s2Point";
612+
};
613+
};
614+
566615
/**
567616
* Shared attributes of all Analyzer descriptions.
568617
*/
@@ -596,7 +645,8 @@ export type AnalyzerDescription =
596645
| ClassificationAnalyzerDescription
597646
| NearestNeighborsAnalyzerDescription
598647
| GeoJsonAnalyzerDescription
599-
| GeoPointAnalyzerDescription;
648+
| GeoPointAnalyzerDescription
649+
| GeoS2AnalyzerDescription;
600650

601651
/**
602652
* An object describing an Identity Analyzer.
@@ -776,6 +826,18 @@ export type GeoPointAnalyzerDescription = GenericAnalyzerDescription & {
776826
};
777827
};
778828

829+
/**
830+
* (Enterprise Edition only.) An object describing a GeoS2 Analyzer
831+
*/
832+
export type GeoS2AnalyzerDescription = GenericAnalyzerDescription & {
833+
type: "geo_s2";
834+
properties: {
835+
type: "shape" | "centroid" | "point";
836+
description: { maxCells: number; minLevel: number; maxLevel: number };
837+
format: "latLngDouble" | "latLngInt" | "s2Point";
838+
};
839+
};
840+
779841
/**
780842
* Represents an Analyzer in a {@link database.Database}.
781843
*/
@@ -899,6 +961,8 @@ export class Analyzer {
899961
? GeoJsonAnalyzerDescription
900962
: Options extends CreateGeoPointAnalyzerOptions
901963
? GeoPointAnalyzerDescription
964+
: Options extends CreateGeoS2AnalyzerOptions
965+
? GeoS2AnalyzerDescription
902966
: AnalyzerDescription
903967
> {
904968
return this._db.request({

0 commit comments

Comments
 (0)