17
17
use function key ;
18
18
19
19
/**
20
- * @phpstan-type SearchIndexField array{type: 'boolean'|'date'|'dateFacet'|'objectId'|'stringFacet'|'uuid'} | array{type: 'autocomplete', analyzer?: string, maxGrams?: int, minGrams?: int, tokenization?: 'edgeGram'|'rightEdgeGram'|'nGram', foldDiacritics?: bool} | array{type: 'document'|'embeddedDocuments', dynamic?:bool, fields: array<string, array>} | array{type: 'geo', indexShapes?: bool} | array{type: 'number'|'numberFacet', representation?: 'int64'|'double', indexIntegers?: bool, indexDoubles?: bool} | array{type: 'token', normalizer?: 'lowercase'|'none'} | array{type: 'string', analyzer?: string, searchAnalyzer?: string, indexOptions?: 'docs'|'freqs'|'positions'|'offsets', store?: bool, ignoreAbove?: int, multi?: array<string, array>, norms?: 'include'|'omit'}
21
- * @phpstan-type SearchIndexAnalyser array{name: string, charFilters?: list<array<string, mixed>>, tokenizer: array{type: string}, tokenFilters?: list<array<string, mixed>>}
22
- * @phpstan-type SearchIndexStoredSource bool | array{includes: array<string>} | array{excludes: array<string>}
23
- * @phpstan-type SearchIndexDefinition array{analyser?: string, analyzers?: SearchIndexAnalyser[], searchAnalyzer?: string, mappings: array{dynamic: true} | array{dynamic?: bool, fields: array<string, SearchIndexField>}, storedSource?: SearchIndexStoredSource}
24
- * @phpstan-type VectorSearchIndexField array{type: 'vector', path: string, numDimensions: int, similarity: 'euclidean'|'cosine'|'dotProduct', quantization?: 'none'|'scalar'|'binary'}
25
- * @phpstan-type VectorSearchIndexDefinition array{fields: array<string, VectorSearchIndexField>}
20
+ * @phpstan-type TypeSearchIndexField array{
21
+ * type: 'boolean'|'date'|'dateFacet'|'objectId'|'stringFacet'|'uuid',
22
+ * } | array{
23
+ * type: 'autocomplete',
24
+ * analyzer?: string,
25
+ * maxGrams?: int,
26
+ * minGrams?: int,
27
+ * tokenization?: 'edgeGram'|'rightEdgeGram'|'nGram',
28
+ * foldDiacritics?: bool,
29
+ * } | array{
30
+ * type: 'document'|'embeddedDocuments',
31
+ * dynamic?:bool,
32
+ * fields: array<string, array<mixed>>,
33
+ * } | array{
34
+ * type: 'geo',
35
+ * indexShapes?: bool,
36
+ * } | array{
37
+ * type: 'number'|'numberFacet',
38
+ * representation?: 'int64'|'double',
39
+ * indexIntegers?: bool,
40
+ * indexDoubles?: bool,
41
+ * } | array{
42
+ * type: 'token',
43
+ * normalizer?: 'lowercase'|'none',
44
+ * } | array{
45
+ * type: 'string',
46
+ * analyzer?: string,
47
+ * searchAnalyzer?: string,
48
+ * indexOptions?: 'docs'|'freqs'|'positions'|'offsets',
49
+ * store?: bool,
50
+ * ignoreAbove?: int,
51
+ * multi?: array<string, array<mixed>>,
52
+ * norms?: 'include'|'omit',
53
+ * }
54
+ * @phpstan-type TypeSearchIndexCharFilter array{
55
+ * type: 'icuNormalize'|'persian',
56
+ * } | array{
57
+ * type: 'htmlStrip',
58
+ * ignoredTags?: string[],
59
+ * } | array{
60
+ * type: 'mapping',
61
+ * mappings?: array<string, string>,
62
+ * }
63
+ * @phpstan-type TypeSearchIndexTokenFilter array{type: string, ...}
64
+ * @phpstan-type TypeSearchIndexAnalyzer array{
65
+ * name: string,
66
+ * charFilters?: TypeSearchIndexCharFilter,
67
+ * tokenizer: array{type: string},
68
+ * tokenFilters?: TypeSearchIndexTokenFilter,
69
+ * }
70
+ * @phpstan-type TypeSearchIndexStoredSource bool | array{
71
+ * includes: array<string>,
72
+ * } | array{
73
+ * excludes: array<string>,
74
+ * }
75
+ * @phpstan-type TypeSearchIndexDefinition array{
76
+ * analyser?: string,
77
+ * analyzers?: TypeSearchIndexAnalyzer[],
78
+ * searchAnalyzer?: string,
79
+ * mappings: array{dynamic: true} | array{dynamic?: bool, fields: array<string, TypeSearchIndexField>},
80
+ * storedSource?: TypeSearchIndexStoredSource,
81
+ * }
82
+ * @phpstan-type TypeVectorSearchIndexField array{
83
+ * type: 'vector',
84
+ * path: string,
85
+ * numDimensions: int,
86
+ * similarity: 'euclidean'|'cosine'|'dotProduct',
87
+ * quantization?: 'none'|'scalar'|'binary',
88
+ * } | array{
89
+ * type: 'filter',
90
+ * path: string,
91
+ * }
92
+ * @phpstan-type TypeVectorSearchIndexDefinition array{
93
+ * fields: array<string, TypeVectorSearchIndexField>,
94
+ * }
26
95
*/
27
96
class Blueprint extends SchemaBlueprint
28
97
{
@@ -314,9 +383,9 @@ public function sparse_and_unique($columns = null, $options = [])
314
383
/**
315
384
* Create an Atlas Search Index.
316
385
*
317
- * @see https://www.mongodb.com/docs/atlas/atlas-search /
386
+ * @see https://www.mongodb.com/docs/manual/reference/command/createSearchIndexes /
318
387
*
319
- * @phpstan-param SearchIndexDefinition $definition
388
+ * @phpstan-param TypeSearchIndexDefinition $definition
320
389
*/
321
390
public function searchIndex (array $ definition , string $ name = 'default ' ): static
322
391
{
@@ -330,7 +399,7 @@ public function searchIndex(array $definition, string $name = 'default'): static
330
399
*
331
400
* @see https://www.mongodb.com/docs/atlas/atlas-vector-search/
332
401
*
333
- * @phpstan-param VectorSearchIndexDefinition $definition
402
+ * @phpstan-param TypeVectorSearchIndexDefinition $definition
334
403
*/
335
404
public function vectorSearchIndex (array $ definition , string $ name = 'default ' ): static
336
405
{
0 commit comments