@topgunbuild/core 0.7.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1161,12 +1161,35 @@ declare function serialize(data: unknown): Uint8Array;
1161
1161
  */
1162
1162
  declare function deserialize<T = unknown>(data: Uint8Array | ArrayBuffer): T;
1163
1163
 
1164
- type PredicateOp = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'like' | 'regex' | 'contains' | 'containsAll' | 'containsAny' | 'and' | 'or' | 'not';
1164
+ type PredicateOp = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'like' | 'regex' | 'contains' | 'containsAll' | 'containsAny' | 'and' | 'or' | 'not' | 'match' | 'matchPhrase' | 'matchPrefix';
1165
+ /**
1166
+ * Options for full-text search match predicate.
1167
+ */
1168
+ interface MatchOptions {
1169
+ /** Minimum BM25 score threshold */
1170
+ minScore?: number;
1171
+ /** Boost factor for this field */
1172
+ boost?: number;
1173
+ /** Operator for multi-term queries: 'and' requires all terms, 'or' requires any */
1174
+ operator?: 'and' | 'or';
1175
+ /** Fuzziness level for typo tolerance (0 = exact, 1 = 1 edit, 2 = 2 edits) */
1176
+ fuzziness?: number;
1177
+ }
1165
1178
  interface PredicateNode {
1166
1179
  op: PredicateOp;
1167
1180
  attribute?: string;
1168
1181
  value?: any;
1169
1182
  children?: PredicateNode[];
1183
+ /** FTS-specific: search query string */
1184
+ query?: string;
1185
+ /** FTS-specific: match options */
1186
+ matchOptions?: MatchOptions;
1187
+ /** FTS-specific: phrase slop (word distance tolerance) */
1188
+ slop?: number;
1189
+ /** FTS-specific: prefix for matchPrefix */
1190
+ prefix?: string;
1191
+ /** FTS-specific: max prefix expansions */
1192
+ maxExpansions?: number;
1170
1193
  }
1171
1194
  declare class Predicates {
1172
1195
  static equal(attribute: string, value: any): PredicateNode;
@@ -1205,6 +1228,82 @@ declare class Predicates {
1205
1228
  * @param values - Text values, any of which can match
1206
1229
  */
1207
1230
  static containsAny(attribute: string, values: string[]): PredicateNode;
1231
+ /**
1232
+ * Create a 'match' predicate for full-text search.
1233
+ * Uses BM25 scoring to find relevant documents.
1234
+ *
1235
+ * @param attribute - Field to search in
1236
+ * @param query - Search query string
1237
+ * @param options - Match options (minScore, boost, operator, fuzziness)
1238
+ *
1239
+ * @example
1240
+ * ```typescript
1241
+ * // Simple match
1242
+ * Predicates.match('title', 'machine learning')
1243
+ *
1244
+ * // With options
1245
+ * Predicates.match('body', 'neural networks', { minScore: 1.0, boost: 2.0 })
1246
+ * ```
1247
+ */
1248
+ static match(attribute: string, query: string, options?: MatchOptions): PredicateNode;
1249
+ /**
1250
+ * Create a 'matchPhrase' predicate for exact phrase matching.
1251
+ * Matches documents containing the exact phrase (words in order).
1252
+ *
1253
+ * @param attribute - Field to search in
1254
+ * @param query - Phrase to match
1255
+ * @param slop - Word distance tolerance (0 = exact, 1 = allow 1 word between)
1256
+ *
1257
+ * @example
1258
+ * ```typescript
1259
+ * // Exact phrase
1260
+ * Predicates.matchPhrase('body', 'machine learning')
1261
+ *
1262
+ * // With slop (allows "machine deep learning")
1263
+ * Predicates.matchPhrase('body', 'machine learning', 1)
1264
+ * ```
1265
+ */
1266
+ static matchPhrase(attribute: string, query: string, slop?: number): PredicateNode;
1267
+ /**
1268
+ * Create a 'matchPrefix' predicate for prefix matching.
1269
+ * Matches documents where field starts with the given prefix.
1270
+ *
1271
+ * @param attribute - Field to search in
1272
+ * @param prefix - Prefix to match
1273
+ * @param maxExpansions - Maximum number of term expansions
1274
+ *
1275
+ * @example
1276
+ * ```typescript
1277
+ * // Match titles starting with "mach"
1278
+ * Predicates.matchPrefix('title', 'mach')
1279
+ *
1280
+ * // Limit expansions for performance
1281
+ * Predicates.matchPrefix('title', 'mach', 50)
1282
+ * ```
1283
+ */
1284
+ static matchPrefix(attribute: string, prefix: string, maxExpansions?: number): PredicateNode;
1285
+ /**
1286
+ * Create a multi-field match predicate.
1287
+ * Searches across multiple fields with optional per-field boosting.
1288
+ *
1289
+ * @param attributes - Fields to search in
1290
+ * @param query - Search query string
1291
+ * @param options - Options including per-field boost factors
1292
+ *
1293
+ * @example
1294
+ * ```typescript
1295
+ * // Search title and body
1296
+ * Predicates.multiMatch(['title', 'body'], 'machine learning')
1297
+ *
1298
+ * // With boosting (title 2x more important)
1299
+ * Predicates.multiMatch(['title', 'body'], 'machine learning', {
1300
+ * boost: { title: 2.0, body: 1.0 }
1301
+ * })
1302
+ * ```
1303
+ */
1304
+ static multiMatch(attributes: string[], query: string, options?: {
1305
+ boost?: Record<string, number>;
1306
+ }): PredicateNode;
1208
1307
  }
1209
1308
  declare function evaluatePredicate(predicate: PredicateNode, data: any): boolean;
1210
1309
 
@@ -1897,6 +1996,147 @@ declare const JournalReadResponseSchema: z.ZodObject<{
1897
1996
  }, z.core.$strip>>;
1898
1997
  hasMore: z.ZodBoolean;
1899
1998
  }, z.core.$strip>;
1999
+ /**
2000
+ * Search options schema for FTS queries.
2001
+ */
2002
+ declare const SearchOptionsSchema: z.ZodObject<{
2003
+ limit: z.ZodOptional<z.ZodNumber>;
2004
+ minScore: z.ZodOptional<z.ZodNumber>;
2005
+ boost: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
2006
+ }, z.core.$strip>;
2007
+ /**
2008
+ * SEARCH: Client requests one-shot BM25 search.
2009
+ */
2010
+ declare const SearchPayloadSchema: z.ZodObject<{
2011
+ requestId: z.ZodString;
2012
+ mapName: z.ZodString;
2013
+ query: z.ZodString;
2014
+ options: z.ZodOptional<z.ZodObject<{
2015
+ limit: z.ZodOptional<z.ZodNumber>;
2016
+ minScore: z.ZodOptional<z.ZodNumber>;
2017
+ boost: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
2018
+ }, z.core.$strip>>;
2019
+ }, z.core.$strip>;
2020
+ declare const SearchMessageSchema: z.ZodObject<{
2021
+ type: z.ZodLiteral<"SEARCH">;
2022
+ payload: z.ZodObject<{
2023
+ requestId: z.ZodString;
2024
+ mapName: z.ZodString;
2025
+ query: z.ZodString;
2026
+ options: z.ZodOptional<z.ZodObject<{
2027
+ limit: z.ZodOptional<z.ZodNumber>;
2028
+ minScore: z.ZodOptional<z.ZodNumber>;
2029
+ boost: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
2030
+ }, z.core.$strip>>;
2031
+ }, z.core.$strip>;
2032
+ }, z.core.$strip>;
2033
+ /**
2034
+ * SEARCH_RESP: Server responds with search results.
2035
+ */
2036
+ declare const SearchRespPayloadSchema: z.ZodObject<{
2037
+ requestId: z.ZodString;
2038
+ results: z.ZodArray<z.ZodObject<{
2039
+ key: z.ZodString;
2040
+ value: z.ZodUnknown;
2041
+ score: z.ZodNumber;
2042
+ matchedTerms: z.ZodArray<z.ZodString>;
2043
+ }, z.core.$strip>>;
2044
+ totalCount: z.ZodNumber;
2045
+ error: z.ZodOptional<z.ZodString>;
2046
+ }, z.core.$strip>;
2047
+ declare const SearchRespMessageSchema: z.ZodObject<{
2048
+ type: z.ZodLiteral<"SEARCH_RESP">;
2049
+ payload: z.ZodObject<{
2050
+ requestId: z.ZodString;
2051
+ results: z.ZodArray<z.ZodObject<{
2052
+ key: z.ZodString;
2053
+ value: z.ZodUnknown;
2054
+ score: z.ZodNumber;
2055
+ matchedTerms: z.ZodArray<z.ZodString>;
2056
+ }, z.core.$strip>>;
2057
+ totalCount: z.ZodNumber;
2058
+ error: z.ZodOptional<z.ZodString>;
2059
+ }, z.core.$strip>;
2060
+ }, z.core.$strip>;
2061
+ /**
2062
+ * Search delta update type.
2063
+ * - ENTER: Document entered the result set (new or score exceeded minScore)
2064
+ * - UPDATE: Document score changed while remaining in result set
2065
+ * - LEAVE: Document left the result set (removed or score dropped below minScore)
2066
+ */
2067
+ declare const SearchUpdateTypeSchema: z.ZodEnum<{
2068
+ UPDATE: "UPDATE";
2069
+ ENTER: "ENTER";
2070
+ LEAVE: "LEAVE";
2071
+ }>;
2072
+ /**
2073
+ * SEARCH_SUB: Client subscribes to live search results.
2074
+ */
2075
+ declare const SearchSubPayloadSchema: z.ZodObject<{
2076
+ subscriptionId: z.ZodString;
2077
+ mapName: z.ZodString;
2078
+ query: z.ZodString;
2079
+ options: z.ZodOptional<z.ZodObject<{
2080
+ limit: z.ZodOptional<z.ZodNumber>;
2081
+ minScore: z.ZodOptional<z.ZodNumber>;
2082
+ boost: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
2083
+ }, z.core.$strip>>;
2084
+ }, z.core.$strip>;
2085
+ declare const SearchSubMessageSchema: z.ZodObject<{
2086
+ type: z.ZodLiteral<"SEARCH_SUB">;
2087
+ payload: z.ZodObject<{
2088
+ subscriptionId: z.ZodString;
2089
+ mapName: z.ZodString;
2090
+ query: z.ZodString;
2091
+ options: z.ZodOptional<z.ZodObject<{
2092
+ limit: z.ZodOptional<z.ZodNumber>;
2093
+ minScore: z.ZodOptional<z.ZodNumber>;
2094
+ boost: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
2095
+ }, z.core.$strip>>;
2096
+ }, z.core.$strip>;
2097
+ }, z.core.$strip>;
2098
+ /**
2099
+ * SEARCH_UPDATE: Server sends delta update for a subscribed search.
2100
+ */
2101
+ declare const SearchUpdatePayloadSchema: z.ZodObject<{
2102
+ subscriptionId: z.ZodString;
2103
+ key: z.ZodString;
2104
+ value: z.ZodUnknown;
2105
+ score: z.ZodNumber;
2106
+ matchedTerms: z.ZodArray<z.ZodString>;
2107
+ type: z.ZodEnum<{
2108
+ UPDATE: "UPDATE";
2109
+ ENTER: "ENTER";
2110
+ LEAVE: "LEAVE";
2111
+ }>;
2112
+ }, z.core.$strip>;
2113
+ declare const SearchUpdateMessageSchema: z.ZodObject<{
2114
+ type: z.ZodLiteral<"SEARCH_UPDATE">;
2115
+ payload: z.ZodObject<{
2116
+ subscriptionId: z.ZodString;
2117
+ key: z.ZodString;
2118
+ value: z.ZodUnknown;
2119
+ score: z.ZodNumber;
2120
+ matchedTerms: z.ZodArray<z.ZodString>;
2121
+ type: z.ZodEnum<{
2122
+ UPDATE: "UPDATE";
2123
+ ENTER: "ENTER";
2124
+ LEAVE: "LEAVE";
2125
+ }>;
2126
+ }, z.core.$strip>;
2127
+ }, z.core.$strip>;
2128
+ /**
2129
+ * SEARCH_UNSUB: Client unsubscribes from live search.
2130
+ */
2131
+ declare const SearchUnsubPayloadSchema: z.ZodObject<{
2132
+ subscriptionId: z.ZodString;
2133
+ }, z.core.$strip>;
2134
+ declare const SearchUnsubMessageSchema: z.ZodObject<{
2135
+ type: z.ZodLiteral<"SEARCH_UNSUB">;
2136
+ payload: z.ZodObject<{
2137
+ subscriptionId: z.ZodString;
2138
+ }, z.core.$strip>;
2139
+ }, z.core.$strip>;
1900
2140
  /**
1901
2141
  * Conflict resolver definition schema (wire format).
1902
2142
  */
@@ -2488,6 +2728,62 @@ declare const MessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2488
2728
  priority: z.ZodOptional<z.ZodNumber>;
2489
2729
  keyPattern: z.ZodOptional<z.ZodString>;
2490
2730
  }, z.core.$strip>>;
2731
+ }, z.core.$strip>, z.ZodObject<{
2732
+ type: z.ZodLiteral<"SEARCH">;
2733
+ payload: z.ZodObject<{
2734
+ requestId: z.ZodString;
2735
+ mapName: z.ZodString;
2736
+ query: z.ZodString;
2737
+ options: z.ZodOptional<z.ZodObject<{
2738
+ limit: z.ZodOptional<z.ZodNumber>;
2739
+ minScore: z.ZodOptional<z.ZodNumber>;
2740
+ boost: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
2741
+ }, z.core.$strip>>;
2742
+ }, z.core.$strip>;
2743
+ }, z.core.$strip>, z.ZodObject<{
2744
+ type: z.ZodLiteral<"SEARCH_RESP">;
2745
+ payload: z.ZodObject<{
2746
+ requestId: z.ZodString;
2747
+ results: z.ZodArray<z.ZodObject<{
2748
+ key: z.ZodString;
2749
+ value: z.ZodUnknown;
2750
+ score: z.ZodNumber;
2751
+ matchedTerms: z.ZodArray<z.ZodString>;
2752
+ }, z.core.$strip>>;
2753
+ totalCount: z.ZodNumber;
2754
+ error: z.ZodOptional<z.ZodString>;
2755
+ }, z.core.$strip>;
2756
+ }, z.core.$strip>, z.ZodObject<{
2757
+ type: z.ZodLiteral<"SEARCH_SUB">;
2758
+ payload: z.ZodObject<{
2759
+ subscriptionId: z.ZodString;
2760
+ mapName: z.ZodString;
2761
+ query: z.ZodString;
2762
+ options: z.ZodOptional<z.ZodObject<{
2763
+ limit: z.ZodOptional<z.ZodNumber>;
2764
+ minScore: z.ZodOptional<z.ZodNumber>;
2765
+ boost: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
2766
+ }, z.core.$strip>>;
2767
+ }, z.core.$strip>;
2768
+ }, z.core.$strip>, z.ZodObject<{
2769
+ type: z.ZodLiteral<"SEARCH_UPDATE">;
2770
+ payload: z.ZodObject<{
2771
+ subscriptionId: z.ZodString;
2772
+ key: z.ZodString;
2773
+ value: z.ZodUnknown;
2774
+ score: z.ZodNumber;
2775
+ matchedTerms: z.ZodArray<z.ZodString>;
2776
+ type: z.ZodEnum<{
2777
+ UPDATE: "UPDATE";
2778
+ ENTER: "ENTER";
2779
+ LEAVE: "LEAVE";
2780
+ }>;
2781
+ }, z.core.$strip>;
2782
+ }, z.core.$strip>, z.ZodObject<{
2783
+ type: z.ZodLiteral<"SEARCH_UNSUB">;
2784
+ payload: z.ZodObject<{
2785
+ subscriptionId: z.ZodString;
2786
+ }, z.core.$strip>;
2491
2787
  }, z.core.$strip>], "type">;
2492
2788
  type Query$1 = z.infer<typeof QuerySchema>;
2493
2789
  type ClientOp = z.infer<typeof ClientOpSchema>;
@@ -2517,6 +2813,18 @@ type UnregisterResolverResponse = z.infer<typeof UnregisterResolverResponseSchem
2517
2813
  type MergeRejectedMessage = z.infer<typeof MergeRejectedMessageSchema>;
2518
2814
  type ListResolversRequest = z.infer<typeof ListResolversRequestSchema>;
2519
2815
  type ListResolversResponse = z.infer<typeof ListResolversResponseSchema>;
2816
+ type SearchOptions$1 = z.infer<typeof SearchOptionsSchema>;
2817
+ type SearchPayload = z.infer<typeof SearchPayloadSchema>;
2818
+ type SearchMessage = z.infer<typeof SearchMessageSchema>;
2819
+ type SearchRespPayload = z.infer<typeof SearchRespPayloadSchema>;
2820
+ type SearchRespMessage = z.infer<typeof SearchRespMessageSchema>;
2821
+ type SearchUpdateType = z.infer<typeof SearchUpdateTypeSchema>;
2822
+ type SearchSubPayload = z.infer<typeof SearchSubPayloadSchema>;
2823
+ type SearchSubMessage = z.infer<typeof SearchSubMessageSchema>;
2824
+ type SearchUpdatePayload = z.infer<typeof SearchUpdatePayloadSchema>;
2825
+ type SearchUpdateMessage = z.infer<typeof SearchUpdateMessageSchema>;
2826
+ type SearchUnsubPayload = z.infer<typeof SearchUnsubPayloadSchema>;
2827
+ type SearchUnsubMessage = z.infer<typeof SearchUnsubMessageSchema>;
2520
2828
 
2521
2829
  /**
2522
2830
  * Write Concern - Configurable Acknowledgment Levels
@@ -3558,6 +3866,52 @@ interface SimpleQueryNode extends QueryNode {
3558
3866
  /** For 'between' queries: include upper bound (default: false) */
3559
3867
  toInclusive?: boolean;
3560
3868
  }
3869
+ /**
3870
+ * Options for full-text search match queries.
3871
+ */
3872
+ interface MatchQueryOptions {
3873
+ /** Minimum BM25 score threshold */
3874
+ minScore?: number;
3875
+ /** Boost factor for this field */
3876
+ boost?: number;
3877
+ /** Operator for multi-term queries: 'and' requires all terms, 'or' requires any */
3878
+ operator?: 'and' | 'or';
3879
+ /** Fuzziness level for typo tolerance (0 = exact, 1 = 1 edit, 2 = 2 edits) */
3880
+ fuzziness?: number;
3881
+ }
3882
+ /**
3883
+ * Match query node for BM25 full-text search.
3884
+ */
3885
+ interface MatchQueryNode extends QueryNode {
3886
+ type: 'match';
3887
+ attribute: string;
3888
+ query: string;
3889
+ options?: MatchQueryOptions;
3890
+ }
3891
+ /**
3892
+ * Match phrase query node for exact phrase matching.
3893
+ */
3894
+ interface MatchPhraseQueryNode extends QueryNode {
3895
+ type: 'matchPhrase';
3896
+ attribute: string;
3897
+ query: string;
3898
+ /** Word distance tolerance (0 = exact phrase) */
3899
+ slop?: number;
3900
+ }
3901
+ /**
3902
+ * Match prefix query node for prefix matching.
3903
+ */
3904
+ interface MatchPrefixQueryNode extends QueryNode {
3905
+ type: 'matchPrefix';
3906
+ attribute: string;
3907
+ prefix: string;
3908
+ /** Maximum number of term expansions */
3909
+ maxExpansions?: number;
3910
+ }
3911
+ /**
3912
+ * Union type for FTS query nodes.
3913
+ */
3914
+ type FTSQueryNode = MatchQueryNode | MatchPhraseQueryNode | MatchPrefixQueryNode;
3561
3915
  /**
3562
3916
  * Logical query node for combining conditions.
3563
3917
  */
@@ -3569,7 +3923,7 @@ interface LogicalQueryNode {
3569
3923
  /**
3570
3924
  * Union type for all query types.
3571
3925
  */
3572
- type Query = SimpleQueryNode | LogicalQueryNode;
3926
+ type Query = SimpleQueryNode | LogicalQueryNode | FTSQueryNode;
3573
3927
  /**
3574
3928
  * Query execution options for sort/limit/offset.
3575
3929
  */
@@ -3585,7 +3939,7 @@ interface QueryOptions {
3585
3939
  * Execution plan step.
3586
3940
  * Represents a single operation in the query execution plan.
3587
3941
  */
3588
- type PlanStep = IndexScanStep | FullScanStep | IntersectionStep | UnionStep | FilterStep | NotStep;
3942
+ type PlanStep = IndexScanStep | FullScanStep | IntersectionStep | UnionStep | FilterStep | NotStep | FTSScanStep | FusionStep;
3589
3943
  /**
3590
3944
  * Index scan step - retrieves from an index.
3591
3945
  */
@@ -3631,6 +3985,41 @@ interface NotStep {
3631
3985
  source: PlanStep;
3632
3986
  allKeys: () => Set<unknown>;
3633
3987
  }
3988
+ /**
3989
+ * Fusion strategy for combining results from different search methods.
3990
+ */
3991
+ type FusionStrategy = 'intersection' | 'rrf' | 'score-filter';
3992
+ /**
3993
+ * FTS scan step - full-text search using FullTextIndex.
3994
+ * Returns scored results (documents with BM25 scores).
3995
+ */
3996
+ interface FTSScanStep {
3997
+ type: 'fts-scan';
3998
+ /** Field to search */
3999
+ field: string;
4000
+ /** Search query or phrase */
4001
+ query: string;
4002
+ /** Type of FTS query */
4003
+ ftsType: 'match' | 'matchPhrase' | 'matchPrefix';
4004
+ /** Query options (minScore, boost, etc.) */
4005
+ options?: MatchQueryOptions;
4006
+ /** This step returns scored results */
4007
+ returnsScored: true;
4008
+ /** Estimated cost */
4009
+ estimatedCost: number;
4010
+ }
4011
+ /**
4012
+ * Fusion step - combines results from multiple steps using RRF or other strategy.
4013
+ */
4014
+ interface FusionStep {
4015
+ type: 'fusion';
4016
+ /** Steps to combine */
4017
+ steps: PlanStep[];
4018
+ /** Fusion strategy */
4019
+ strategy: FusionStrategy;
4020
+ /** Whether result is scored (true if any child is scored) */
4021
+ returnsScored: boolean;
4022
+ }
3634
4023
  /**
3635
4024
  * Complete query execution plan.
3636
4025
  */
@@ -4729,6 +5118,610 @@ declare class LazyInvertedIndex<K, V, A extends string = string> implements Lazy
4729
5118
  getTokenDocumentCount(token: string): number;
4730
5119
  }
4731
5120
 
5121
+ /**
5122
+ * Full-Text Search Types
5123
+ *
5124
+ * Type definitions for the FTS (Full-Text Search) module.
5125
+ * This module provides BM25-based keyword search capabilities.
5126
+ *
5127
+ * @module fts/types
5128
+ */
5129
+ /**
5130
+ * Options for configuring the FTS Tokenizer.
5131
+ */
5132
+ interface TokenizerOptions {
5133
+ /**
5134
+ * Convert all text to lowercase before tokenization.
5135
+ * @default true
5136
+ */
5137
+ lowercase?: boolean;
5138
+ /**
5139
+ * Set of words to exclude from tokenization (e.g., "the", "and", "is").
5140
+ * @default ENGLISH_STOPWORDS (174 words)
5141
+ */
5142
+ stopwords?: Set<string>;
5143
+ /**
5144
+ * Function to reduce words to their root form.
5145
+ * @default Porter stemmer
5146
+ */
5147
+ stemmer?: (word: string) => string;
5148
+ /**
5149
+ * Minimum token length to include in results.
5150
+ * @default 2
5151
+ */
5152
+ minLength?: number;
5153
+ /**
5154
+ * Maximum token length to include in results.
5155
+ * @default 40
5156
+ */
5157
+ maxLength?: number;
5158
+ }
5159
+ /**
5160
+ * Information about a term's occurrence in a document.
5161
+ */
5162
+ interface TermInfo {
5163
+ /** Document ID where the term appears */
5164
+ docId: string;
5165
+ /** Number of times the term appears in the document */
5166
+ termFrequency: number;
5167
+ /** Optional: positions of the term for phrase search (future) */
5168
+ fieldPositions?: number[];
5169
+ }
5170
+ /**
5171
+ * Posting list entry for the inverted index.
5172
+ */
5173
+ interface Posting {
5174
+ /** Document ID */
5175
+ docId: string;
5176
+ /** Term frequency in this document */
5177
+ termFrequency: number;
5178
+ /** Optional: positions for phrase search */
5179
+ positions?: number[];
5180
+ }
5181
+ /**
5182
+ * BM25 algorithm configuration options.
5183
+ */
5184
+ interface BM25Options {
5185
+ /**
5186
+ * Term frequency saturation parameter.
5187
+ * Higher values give more weight to repeated terms.
5188
+ * @default 1.2
5189
+ */
5190
+ k1?: number;
5191
+ /**
5192
+ * Document length normalization parameter.
5193
+ * 0 = no length normalization, 1 = full normalization.
5194
+ * @default 0.75
5195
+ */
5196
+ b?: number;
5197
+ }
5198
+ /**
5199
+ * A document with its BM25 relevance score.
5200
+ */
5201
+ interface ScoredDocument {
5202
+ /** Document ID */
5203
+ docId: string;
5204
+ /** BM25 relevance score */
5205
+ score: number;
5206
+ /** Terms from the query that matched this document */
5207
+ matchedTerms: string[];
5208
+ }
5209
+ /**
5210
+ * Configuration for a FullTextIndex.
5211
+ */
5212
+ interface FullTextIndexConfig {
5213
+ /** Fields to index for full-text search (e.g., ['title', 'body']) */
5214
+ fields: string[];
5215
+ /** Tokenizer configuration */
5216
+ tokenizer?: TokenizerOptions;
5217
+ /** BM25 scoring parameters */
5218
+ bm25?: BM25Options;
5219
+ }
5220
+ /**
5221
+ * Options for search queries.
5222
+ */
5223
+ interface SearchOptions {
5224
+ /** Maximum number of results to return */
5225
+ limit?: number;
5226
+ /** Minimum BM25 score threshold */
5227
+ minScore?: number;
5228
+ /** Restrict search to specific fields */
5229
+ fields?: string[];
5230
+ /** Field boost weights (e.g., { title: 2.0, body: 1.0 }) */
5231
+ boost?: Record<string, number>;
5232
+ }
5233
+ /**
5234
+ * Search result with full details.
5235
+ */
5236
+ interface SearchResult {
5237
+ /** Document ID */
5238
+ docId: string;
5239
+ /** BM25 relevance score */
5240
+ score: number;
5241
+ /** Source of the match (for hybrid search) */
5242
+ source?: 'exact' | 'fulltext' | 'vector' | 'bfs';
5243
+ /** Original document data (if requested) */
5244
+ data?: unknown;
5245
+ /** Highlighted text snippet (if requested) */
5246
+ highlightedText?: string;
5247
+ /** Terms that matched */
5248
+ matchedTerms?: string[];
5249
+ /** Document embedding (if available) */
5250
+ embedding?: number[];
5251
+ /** Cosine similarity to query (0-1) */
5252
+ embeddingSimilarity?: number;
5253
+ /** Debug information */
5254
+ debug?: {
5255
+ exactScore?: number;
5256
+ fulltextScore?: number;
5257
+ vectorScore?: number;
5258
+ rangeScore?: number;
5259
+ };
5260
+ }
5261
+ /**
5262
+ * Serialized format for index persistence.
5263
+ */
5264
+ interface SerializedIndex {
5265
+ /** Schema version for backwards compatibility */
5266
+ version: number;
5267
+ /** Index metadata */
5268
+ metadata: {
5269
+ totalDocs: number;
5270
+ avgDocLength: number;
5271
+ createdAt: number;
5272
+ lastModified: number;
5273
+ };
5274
+ /** Serialized term data */
5275
+ terms: Array<{
5276
+ term: string;
5277
+ idf: number;
5278
+ postings: Array<{
5279
+ docId: string;
5280
+ termFrequency: number;
5281
+ positions?: number[];
5282
+ }>;
5283
+ }>;
5284
+ /** Document lengths for BM25 normalization */
5285
+ docLengths: Record<string, number>;
5286
+ }
5287
+
5288
+ /**
5289
+ * English stopwords list (174 common words).
5290
+ * These words are filtered out during tokenization as they
5291
+ * don't contribute to search relevance.
5292
+ */
5293
+ declare const ENGLISH_STOPWORDS: Set<string>;
5294
+
5295
+ /**
5296
+ * Porter Stemming Algorithm
5297
+ *
5298
+ * Reduces English words to their stem (root form).
5299
+ * Based on the algorithm by Martin Porter (1980).
5300
+ *
5301
+ * @see https://tartarus.org/martin/PorterStemmer/
5302
+ *
5303
+ * @param word - Word to stem (should be lowercase)
5304
+ * @returns Stemmed word
5305
+ */
5306
+ declare function porterStem(word: string): string;
5307
+
5308
+ /**
5309
+ * FTS Tokenizer with Porter Stemming and Stopwords
5310
+ *
5311
+ * Provides text tokenization for BM25 full-text search.
5312
+ * Features:
5313
+ * - Unicode-aware word boundary detection
5314
+ * - English stopwords filtering (174 words)
5315
+ * - Porter stemming algorithm for word normalization
5316
+ * - Configurable min/max token length
5317
+ *
5318
+ * @module fts/Tokenizer
5319
+ */
5320
+
5321
+ /**
5322
+ * FTS Tokenizer
5323
+ *
5324
+ * Splits text into searchable tokens with normalization.
5325
+ *
5326
+ * @example
5327
+ * ```typescript
5328
+ * const tokenizer = new BM25Tokenizer();
5329
+ * const tokens = tokenizer.tokenize('The quick brown foxes');
5330
+ * // ['quick', 'brown', 'fox']
5331
+ * ```
5332
+ */
5333
+ declare class BM25Tokenizer implements Tokenizer {
5334
+ private readonly options;
5335
+ /**
5336
+ * Create a new BM25Tokenizer.
5337
+ *
5338
+ * @param options - Configuration options
5339
+ */
5340
+ constructor(options?: TokenizerOptions);
5341
+ /**
5342
+ * Tokenize text into an array of normalized tokens.
5343
+ *
5344
+ * @param text - Text to tokenize
5345
+ * @returns Array of tokens
5346
+ */
5347
+ tokenize(text: string): string[];
5348
+ }
5349
+
5350
+ /**
5351
+ * FTS Inverted Index
5352
+ *
5353
+ * Data structure for full-text search that maps terms to documents.
5354
+ * Supports efficient term lookup, document frequency calculation,
5355
+ * and IDF (Inverse Document Frequency) for BM25 scoring.
5356
+ *
5357
+ * @module fts/BM25InvertedIndex
5358
+ */
5359
+
5360
+ /**
5361
+ * Inverted Index for Full-Text Search (BM25)
5362
+ *
5363
+ * Maps terms to the documents containing them, along with term frequency
5364
+ * information needed for BM25 scoring.
5365
+ *
5366
+ * @example
5367
+ * ```typescript
5368
+ * const index = new BM25InvertedIndex();
5369
+ * index.addDocument('doc1', ['hello', 'world']);
5370
+ * index.addDocument('doc2', ['hello', 'there']);
5371
+ *
5372
+ * const docs = index.getDocumentsForTerm('hello');
5373
+ * // [{ docId: 'doc1', termFrequency: 1 }, { docId: 'doc2', termFrequency: 1 }]
5374
+ * ```
5375
+ */
5376
+ declare class BM25InvertedIndex {
5377
+ /** term → list of documents containing term */
5378
+ private index;
5379
+ /** document → total term count (for length normalization) */
5380
+ private docLengths;
5381
+ /** document → set of terms (for efficient removal) */
5382
+ private docTerms;
5383
+ /** Inverse Document Frequency cache */
5384
+ private idfCache;
5385
+ /** Total number of documents */
5386
+ private totalDocs;
5387
+ /** Average document length */
5388
+ private avgDocLength;
5389
+ constructor();
5390
+ /**
5391
+ * Add a document to the index.
5392
+ *
5393
+ * @param docId - Unique document identifier
5394
+ * @param tokens - Array of tokens (already tokenized/stemmed)
5395
+ */
5396
+ addDocument(docId: string, tokens: string[]): void;
5397
+ /**
5398
+ * Remove a document from the index.
5399
+ *
5400
+ * @param docId - Document identifier to remove
5401
+ */
5402
+ removeDocument(docId: string): void;
5403
+ /**
5404
+ * Get all documents containing a term.
5405
+ *
5406
+ * @param term - Term to look up
5407
+ * @returns Array of TermInfo objects
5408
+ */
5409
+ getDocumentsForTerm(term: string): TermInfo[];
5410
+ /**
5411
+ * Calculate IDF (Inverse Document Frequency) for a term.
5412
+ *
5413
+ * Uses BM25 IDF formula:
5414
+ * IDF = log((N - df + 0.5) / (df + 0.5) + 1)
5415
+ *
5416
+ * Where:
5417
+ * - N = total documents
5418
+ * - df = document frequency (docs containing term)
5419
+ *
5420
+ * @param term - Term to calculate IDF for
5421
+ * @returns IDF value (0 if term doesn't exist)
5422
+ */
5423
+ getIDF(term: string): number;
5424
+ /**
5425
+ * Get the length of a document (number of tokens).
5426
+ *
5427
+ * @param docId - Document identifier
5428
+ * @returns Document length (0 if not found)
5429
+ */
5430
+ getDocLength(docId: string): number;
5431
+ /**
5432
+ * Get the average document length.
5433
+ *
5434
+ * @returns Average length across all documents
5435
+ */
5436
+ getAvgDocLength(): number;
5437
+ /**
5438
+ * Get the total number of documents in the index.
5439
+ *
5440
+ * @returns Total document count
5441
+ */
5442
+ getTotalDocs(): number;
5443
+ /**
5444
+ * Get iterator for document lengths (useful for serialization).
5445
+ *
5446
+ * @returns Iterator of [docId, length] pairs
5447
+ */
5448
+ getDocLengths(): IterableIterator<[string, number]>;
5449
+ /**
5450
+ * Get the number of documents in the index (alias for getTotalDocs).
5451
+ *
5452
+ * @returns Number of indexed documents
5453
+ */
5454
+ getSize(): number;
5455
+ /**
5456
+ * Clear all data from the index.
5457
+ */
5458
+ clear(): void;
5459
+ /**
5460
+ * Check if a document exists in the index.
5461
+ *
5462
+ * @param docId - Document identifier
5463
+ * @returns True if document exists
5464
+ */
5465
+ hasDocument(docId: string): boolean;
5466
+ /**
5467
+ * Get all unique terms in the index.
5468
+ *
5469
+ * @returns Iterator of all terms
5470
+ */
5471
+ getTerms(): IterableIterator<string>;
5472
+ /**
5473
+ * Get the number of unique terms in the index.
5474
+ *
5475
+ * @returns Number of unique terms
5476
+ */
5477
+ getTermCount(): number;
5478
+ /**
5479
+ * Update the average document length after add/remove.
5480
+ */
5481
+ private updateAvgDocLength;
5482
+ }
5483
+
5484
+ /**
5485
+ * BM25 Scorer
5486
+ *
5487
+ * Implements the Okapi BM25 ranking algorithm for full-text search.
5488
+ * BM25 is a probabilistic relevance ranking function used to estimate
5489
+ * the relevance of documents to a given search query.
5490
+ *
5491
+ * @see https://en.wikipedia.org/wiki/Okapi_BM25
5492
+ * @module fts/BM25Scorer
5493
+ */
5494
+
5495
+ /**
5496
+ * BM25 Scorer for relevance ranking
5497
+ *
5498
+ * The BM25 formula:
5499
+ * score(D,Q) = Σ IDF(qi) × (f(qi,D) × (k1 + 1)) / (f(qi,D) + k1 × (1 - b + b × |D| / avgdl))
5500
+ *
5501
+ * Where:
5502
+ * - D = document
5503
+ * - Q = query
5504
+ * - qi = query term i
5505
+ * - f(qi,D) = term frequency of qi in D
5506
+ * - |D| = length of D (number of terms)
5507
+ * - avgdl = average document length
5508
+ * - k1 = term frequency saturation parameter (default: 1.2)
5509
+ * - b = document length normalization parameter (default: 0.75)
5510
+ *
5511
+ * @example
5512
+ * ```typescript
5513
+ * const index = new BM25InvertedIndex();
5514
+ * index.addDocument('doc1', ['hello', 'world']);
5515
+ * index.addDocument('doc2', ['hello', 'there']);
5516
+ *
5517
+ * const scorer = new BM25Scorer();
5518
+ * const results = scorer.score(['hello'], index);
5519
+ * // [{ docId: 'doc1', score: 0.28, matchedTerms: ['hello'] }, ...]
5520
+ * ```
5521
+ */
5522
+ declare class BM25Scorer {
5523
+ /**
5524
+ * Term frequency saturation parameter.
5525
+ * Higher values give more weight to repeated terms.
5526
+ * Typical range: 1.2 - 2.0
5527
+ */
5528
+ private readonly k1;
5529
+ /**
5530
+ * Document length normalization parameter.
5531
+ * 0 = no length normalization
5532
+ * 1 = full length normalization
5533
+ * Typical value: 0.75
5534
+ */
5535
+ private readonly b;
5536
+ /**
5537
+ * Create a new BM25 scorer.
5538
+ *
5539
+ * @param options - BM25 configuration options
5540
+ */
5541
+ constructor(options?: BM25Options);
5542
+ /**
5543
+ * Score documents against a query.
5544
+ *
5545
+ * @param queryTerms - Array of query terms (already tokenized/stemmed)
5546
+ * @param index - The inverted index to search
5547
+ * @returns Array of scored documents, sorted by relevance (descending)
5548
+ */
5549
+ score(queryTerms: string[], index: BM25InvertedIndex): ScoredDocument[];
5550
+ /**
5551
+ * Score a single document against query terms.
5552
+ * Uses pre-computed IDF from index but calculates TF locally.
5553
+ *
5554
+ * Complexity: O(Q × D) where Q = query terms, D = document tokens
5555
+ *
5556
+ * @param queryTerms - Tokenized query terms
5557
+ * @param docTokens - Tokenized document terms
5558
+ * @param index - Inverted index for IDF and avgDocLength
5559
+ * @returns BM25 score (0 if no matching terms)
5560
+ */
5561
+ scoreSingleDocument(queryTerms: string[], docTokens: string[], index: BM25InvertedIndex): number;
5562
+ /**
5563
+ * Get the k1 parameter value.
5564
+ */
5565
+ getK1(): number;
5566
+ /**
5567
+ * Get the b parameter value.
5568
+ */
5569
+ getB(): number;
5570
+ }
5571
+
5572
+ /**
5573
+ * Full-Text Index
5574
+ *
5575
+ * High-level integration class that combines Tokenizer, InvertedIndex,
5576
+ * and BM25Scorer for complete full-text search functionality.
5577
+ * Designed to integrate with TopGun's CRDT maps.
5578
+ *
5579
+ * @module fts/FullTextIndex
5580
+ */
5581
+
5582
+ /**
5583
+ * Full-Text Index for TopGun
5584
+ *
5585
+ * Provides BM25-based full-text search across document fields.
5586
+ * Supports incremental updates (add/update/remove) for real-time sync.
5587
+ *
5588
+ * @example
5589
+ * ```typescript
5590
+ * const index = new FullTextIndex({
5591
+ * fields: ['title', 'body'],
5592
+ * tokenizer: { minLength: 2 },
5593
+ * bm25: { k1: 1.2, b: 0.75 }
5594
+ * });
5595
+ *
5596
+ * index.onSet('doc1', { title: 'Hello World', body: 'Test content' });
5597
+ * const results = index.search('hello');
5598
+ * // [{ docId: 'doc1', score: 0.5, matchedTerms: ['hello'] }]
5599
+ * ```
5600
+ */
5601
+ declare class FullTextIndex {
5602
+ /** Fields to index from documents */
5603
+ private readonly fields;
5604
+ /** Tokenizer for text processing */
5605
+ private readonly tokenizer;
5606
+ /** BM25 scorer for relevance ranking */
5607
+ private readonly scorer;
5608
+ /** Per-field inverted indexes for field boosting */
5609
+ private readonly fieldIndexes;
5610
+ /** Combined index for all fields */
5611
+ private combinedIndex;
5612
+ /** Track indexed documents */
5613
+ private readonly indexedDocs;
5614
+ /** Serializer for persistence */
5615
+ private readonly serializer;
5616
+ /**
5617
+ * Cache of document tokens for fast single-document scoring.
5618
+ * Maps docId → tokenized terms from all indexed fields.
5619
+ */
5620
+ private readonly documentTokensCache;
5621
+ /**
5622
+ * Create a new FullTextIndex.
5623
+ *
5624
+ * @param config - Index configuration
5625
+ */
5626
+ constructor(config: FullTextIndexConfig);
5627
+ /**
5628
+ * Index a document (add or update).
5629
+ * Called when a document is set in the CRDT map.
5630
+ *
5631
+ * @param docId - Document identifier
5632
+ * @param document - Document data containing fields to index
5633
+ */
5634
+ onSet(docId: string, document: Record<string, unknown> | null | undefined): void;
5635
+ /**
5636
+ * Remove a document from the index.
5637
+ * Called when a document is deleted from the CRDT map.
5638
+ *
5639
+ * @param docId - Document identifier to remove
5640
+ */
5641
+ onRemove(docId: string): void;
5642
+ /**
5643
+ * Search the index with a query.
5644
+ *
5645
+ * @param query - Search query text
5646
+ * @param options - Search options (limit, minScore, boost)
5647
+ * @returns Array of search results, sorted by relevance
5648
+ */
5649
+ search(query: string, options?: SearchOptions): SearchResult[];
5650
+ /**
5651
+ * Serialize the index state.
5652
+ *
5653
+ * @returns Serialized index data
5654
+ */
5655
+ serialize(): SerializedIndex;
5656
+ /**
5657
+ * Load index from serialized state.
5658
+ *
5659
+ * @param data - Serialized index data
5660
+ */
5661
+ load(data: SerializedIndex): void;
5662
+ /**
5663
+ * Build the index from an array of entries.
5664
+ * Useful for initial bulk loading.
5665
+ *
5666
+ * @param entries - Array of [docId, document] tuples
5667
+ */
5668
+ buildFromEntries(entries: Array<[string, Record<string, unknown> | null]>): void;
5669
+ /**
5670
+ * Clear all data from the index.
5671
+ */
5672
+ clear(): void;
5673
+ /**
5674
+ * Get the number of indexed documents.
5675
+ *
5676
+ * @returns Number of documents in the index
5677
+ */
5678
+ getSize(): number;
5679
+ /**
5680
+ * Tokenize a query string using the index's tokenizer.
5681
+ * Public method for external use (e.g., SearchCoordinator).
5682
+ *
5683
+ * @param query - Query text to tokenize
5684
+ * @returns Array of tokenized terms
5685
+ */
5686
+ tokenizeQuery(query: string): string[];
5687
+ /**
5688
+ * Score a single document against query terms.
5689
+ * O(Q × D) complexity where Q = query terms, D = document tokens.
5690
+ *
5691
+ * This method is optimized for checking if a single document
5692
+ * matches a query, avoiding full index scan.
5693
+ *
5694
+ * @param docId - Document ID to score
5695
+ * @param queryTerms - Pre-tokenized query terms
5696
+ * @param document - Optional document data (used if not in cache)
5697
+ * @returns SearchResult with score and matched terms, or null if no match
5698
+ */
5699
+ scoreSingleDocument(docId: string, queryTerms: string[], document?: Record<string, unknown>): SearchResult | null;
5700
+ /**
5701
+ * Tokenize all indexed fields of a document.
5702
+ * Internal helper for scoreSingleDocument when document not in cache.
5703
+ *
5704
+ * @param document - Document data
5705
+ * @returns Array of all tokens from indexed fields
5706
+ */
5707
+ private tokenizeDocument;
5708
+ /**
5709
+ * Get the index name (for debugging/display).
5710
+ *
5711
+ * @returns Descriptive name including indexed fields
5712
+ */
5713
+ get name(): string;
5714
+ /**
5715
+ * Remove document from all indexes (internal).
5716
+ */
5717
+ private removeFromIndexes;
5718
+ /**
5719
+ * Search with field boosting.
5720
+ * Scores are computed per-field and combined with boost weights.
5721
+ */
5722
+ private searchWithBoost;
5723
+ }
5724
+
4732
5725
  /**
4733
5726
  * SetResultSet Implementation
4734
5727
  *
@@ -5531,6 +6524,21 @@ interface QueryOptimizerOptions<K, V> {
5531
6524
  indexRegistry: IndexRegistry<K, V>;
5532
6525
  /** Standing query registry for pre-computed queries (optional) */
5533
6526
  standingQueryRegistry?: StandingQueryRegistry<K, V>;
6527
+ /** Full-text index registry for FTS queries (Phase 12) */
6528
+ fullTextIndexes?: Map<string, FullTextIndex>;
6529
+ }
6530
+ /**
6531
+ * Classified predicates by type for hybrid query planning.
6532
+ */
6533
+ interface ClassifiedPredicates {
6534
+ /** Exact match predicates (eq, neq, in) */
6535
+ exactPredicates: Query[];
6536
+ /** Range predicates (gt, gte, lt, lte, between) */
6537
+ rangePredicates: Query[];
6538
+ /** Full-text search predicates (match, matchPhrase, matchPrefix) */
6539
+ ftsPredicates: FTSQueryNode[];
6540
+ /** Other predicates (like, regex, contains, etc.) */
6541
+ otherPredicates: Query[];
5534
6542
  }
5535
6543
  /**
5536
6544
  * Cost-based query optimizer.
@@ -5541,6 +6549,7 @@ interface QueryOptimizerOptions<K, V> {
5541
6549
  declare class QueryOptimizer<K, V> {
5542
6550
  private readonly indexRegistry;
5543
6551
  private readonly standingQueryRegistry?;
6552
+ private readonly fullTextIndexes;
5544
6553
  /**
5545
6554
  * Create a QueryOptimizer.
5546
6555
  *
@@ -5548,6 +6557,33 @@ declare class QueryOptimizer<K, V> {
5548
6557
  * @param standingQueryRegistry - Optional StandingQueryRegistry (deprecated, use options)
5549
6558
  */
5550
6559
  constructor(indexRegistryOrOptions: IndexRegistry<K, V> | QueryOptimizerOptions<K, V>, standingQueryRegistry?: StandingQueryRegistry<K, V>);
6560
+ /**
6561
+ * Register a full-text index for a field (Phase 12).
6562
+ *
6563
+ * @param field - Field name
6564
+ * @param index - FullTextIndex instance
6565
+ */
6566
+ registerFullTextIndex(field: string, index: FullTextIndex): void;
6567
+ /**
6568
+ * Unregister a full-text index (Phase 12).
6569
+ *
6570
+ * @param field - Field name
6571
+ */
6572
+ unregisterFullTextIndex(field: string): void;
6573
+ /**
6574
+ * Get registered full-text index for a field (Phase 12).
6575
+ *
6576
+ * @param field - Field name
6577
+ * @returns FullTextIndex or undefined
6578
+ */
6579
+ getFullTextIndex(field: string): FullTextIndex | undefined;
6580
+ /**
6581
+ * Check if a full-text index exists for a field (Phase 12).
6582
+ *
6583
+ * @param field - Field name
6584
+ * @returns True if FTS index exists
6585
+ */
6586
+ hasFullTextIndex(field: string): boolean;
5551
6587
  /**
5552
6588
  * Optimize a query and return an execution plan.
5553
6589
  *
@@ -5571,6 +6607,41 @@ declare class QueryOptimizer<K, V> {
5571
6607
  * Optimize a single query node.
5572
6608
  */
5573
6609
  private optimizeNode;
6610
+ /**
6611
+ * Optimize a full-text search query (Phase 12).
6612
+ */
6613
+ private optimizeFTS;
6614
+ /**
6615
+ * Build an FTS scan step from a query node (Phase 12).
6616
+ */
6617
+ private buildFTSScanStep;
6618
+ /**
6619
+ * Estimate cost of FTS query based on index size (Phase 12).
6620
+ */
6621
+ private estimateFTSCost;
6622
+ /**
6623
+ * Classify predicates by type for hybrid query planning (Phase 12).
6624
+ *
6625
+ * @param predicates - Array of predicates to classify
6626
+ * @returns Classified predicates
6627
+ */
6628
+ classifyPredicates(predicates: Query[]): ClassifiedPredicates;
6629
+ /**
6630
+ * Determine fusion strategy based on step types (Phase 12).
6631
+ *
6632
+ * Strategy selection:
6633
+ * - All binary (exact/range with no scores) → 'intersection'
6634
+ * - All scored (FTS) → 'score-filter' (filter by score, sort by score)
6635
+ * - Mixed (binary + scored) → 'rrf' (Reciprocal Rank Fusion)
6636
+ *
6637
+ * @param steps - Plan steps to fuse
6638
+ * @returns Fusion strategy
6639
+ */
6640
+ determineFusionStrategy(steps: PlanStep[]): FusionStrategy;
6641
+ /**
6642
+ * Check if a plan step returns scored results (Phase 12).
6643
+ */
6644
+ private stepReturnsScored;
5574
6645
  /**
5575
6646
  * Optimize a simple (attribute-based) query.
5576
6647
  */
@@ -6640,6 +7711,16 @@ interface ORMapQueryResult<K, V> {
6640
7711
  tag: string;
6641
7712
  value: V;
6642
7713
  }
7714
+ /**
7715
+ * Result of a full-text search on IndexedORMap.
7716
+ * Includes BM25 relevance score for ranking.
7717
+ */
7718
+ interface ORMapSearchResult<K, V> extends ORMapQueryResult<K, V> {
7719
+ /** BM25 relevance score */
7720
+ score: number;
7721
+ /** Terms from the query that matched */
7722
+ matchedTerms: string[];
7723
+ }
6643
7724
  /**
6644
7725
  * ORMap with index support.
6645
7726
  *
@@ -6657,6 +7738,7 @@ declare class IndexedORMap<K extends string, V> extends ORMap<K, V> {
6657
7738
  private readonly autoIndexManager;
6658
7739
  private readonly defaultIndexingStrategy;
6659
7740
  private readonly options;
7741
+ private fullTextIndex;
6660
7742
  constructor(hlc: HLC, options?: IndexedMapOptions);
6661
7743
  /**
6662
7744
  * Add a hash index on an attribute.
@@ -6689,6 +7771,59 @@ declare class IndexedORMap<K extends string, V> extends ORMap<K, V> {
6689
7771
  * @param index - Index to add
6690
7772
  */
6691
7773
  addIndex<A>(index: Index<string, V, A>): void;
7774
+ /**
7775
+ * Enable BM25-based full-text search on specified fields.
7776
+ * This creates a FullTextIndex for relevance-ranked search.
7777
+ *
7778
+ * Note: This is different from addInvertedIndex which provides
7779
+ * boolean matching (contains/containsAll/containsAny). This method
7780
+ * provides BM25 relevance scoring for true full-text search.
7781
+ *
7782
+ * @param config - Full-text index configuration
7783
+ * @returns The created FullTextIndex
7784
+ *
7785
+ * @example
7786
+ * ```typescript
7787
+ * const map = new IndexedORMap(hlc);
7788
+ * map.enableFullTextSearch({
7789
+ * fields: ['title', 'body'],
7790
+ * tokenizer: { minLength: 2 },
7791
+ * bm25: { k1: 1.2, b: 0.75 }
7792
+ * });
7793
+ *
7794
+ * map.add('doc1', { title: 'Hello World', body: 'Test content' });
7795
+ * const results = map.search('hello');
7796
+ * // [{ key: 'doc1', tag: '...', value: {...}, score: 0.5, matchedTerms: ['hello'] }]
7797
+ * ```
7798
+ */
7799
+ enableFullTextSearch(config: FullTextIndexConfig): FullTextIndex;
7800
+ /**
7801
+ * Check if full-text search is enabled.
7802
+ *
7803
+ * @returns true if full-text search is enabled
7804
+ */
7805
+ isFullTextSearchEnabled(): boolean;
7806
+ /**
7807
+ * Get the full-text index (if enabled).
7808
+ *
7809
+ * @returns The FullTextIndex or null
7810
+ */
7811
+ getFullTextIndex(): FullTextIndex | null;
7812
+ /**
7813
+ * Perform a BM25-ranked full-text search.
7814
+ * Results are sorted by relevance score (highest first).
7815
+ *
7816
+ * @param query - Search query text
7817
+ * @param options - Search options (limit, minScore, boost)
7818
+ * @returns Array of search results with scores, sorted by relevance
7819
+ *
7820
+ * @throws Error if full-text search is not enabled
7821
+ */
7822
+ search(query: string, options?: SearchOptions): ORMapSearchResult<K, V>[];
7823
+ /**
7824
+ * Disable full-text search and release the index.
7825
+ */
7826
+ disableFullTextSearch(): void;
6692
7827
  /**
6693
7828
  * Remove an index.
6694
7829
  *
@@ -6879,4 +8014,115 @@ declare class IndexedORMap<K extends string, V> extends ORMap<K, V> {
6879
8014
  private extractQueryType;
6880
8015
  }
6881
8016
 
6882
- export { type Attribute, AuthMessageSchema, type BatchMessage, BatchMessageSchema, BuiltInProcessors, BuiltInResolvers, type CircuitBreakerConfig, type ClientOp, ClientOpMessageSchema, ClientOpSchema, type ClusterClientConfig, type ClusterEvents, type ReadOptions as ClusterReadOptions, type WriteOptions as ClusterWriteOptions, type CompareFn, type ConflictResolver, type ConflictResolverDef, ConflictResolverDefSchema, type ConflictResolverFn, ConflictResolverSchema, type ConnectionPoolConfig, type ConnectionState, ConsistencyLevel, CounterRequestSchema, CounterResponseSchema, CounterSyncSchema, CounterUpdateSchema, DEFAULT_BACKUP_COUNT, DEFAULT_CIRCUIT_BREAKER_CONFIG, DEFAULT_CONNECTION_POOL_CONFIG, DEFAULT_EVENT_JOURNAL_CONFIG, DEFAULT_MIGRATION_CONFIG, DEFAULT_PARTITION_ROUTER_CONFIG, DEFAULT_PROCESSOR_RATE_LIMITS, DEFAULT_REPLICATION_CONFIG, DEFAULT_RESOLVER_RATE_LIMITS, DEFAULT_STOP_WORDS, DEFAULT_WRITE_CONCERN_TIMEOUT, type EntryProcessBatchRequest, EntryProcessBatchRequestSchema, type EntryProcessBatchResponse, EntryProcessBatchResponseSchema, type EntryProcessKeyResult, EntryProcessKeyResultSchema, type EntryProcessRequest, EntryProcessRequestSchema, type EntryProcessResponse, EntryProcessResponseSchema, type EntryProcessorDef, EntryProcessorDefSchema, type EntryProcessorFn, type EntryProcessorResult, EntryProcessorSchema, type EventJournal, type EventJournalConfig, EventJournalImpl, FORBIDDEN_PATTERNS, FallbackIndex, type FilterStep, FilteringResultSet, type FullScanStep, HLC, HashIndex, type Index, type IndexQuery, IndexRegistry, type IndexRegistryStats, type IndexScanStep, type IndexStats, IndexedLWWMap, IndexedORMap, IntersectionResultSet, type IntersectionStep, InvertedIndex, type InvertedIndexStats, type IteratorFactory, type JournalEvent, type JournalEventData, JournalEventDataSchema, type JournalEventInput, type JournalEventListener, type JournalEventMessage, JournalEventMessageSchema, type JournalEventType, JournalEventTypeSchema, type JournalReadRequest, JournalReadRequestSchema, type JournalReadResponse, JournalReadResponseSchema, type JournalSubscribeRequest, JournalSubscribeRequestSchema, type JournalUnsubscribeRequest, JournalUnsubscribeRequestSchema, LWWMap, type LWWRecord, LWWRecordSchema, LazyResultSet, LimitResultSet, type ListResolversRequest, ListResolversRequestSchema, type ListResolversResponse, ListResolversResponseSchema, type LiveQueryCallback, type LiveQueryDeltaEvent, type LiveQueryEvent, type LiveQueryInitialEvent, LiveQueryManager, type LiveQueryManagerOptions, type LiveQueryManagerStats, LockReleaseSchema, LockRequestSchema, type LogicalQueryNode, LowercaseFilter, MaxLengthFilter, type MergeContext, type MergeKeyResult, type MergeRejectedMessage, MergeRejectedMessageSchema, type MergeRejection, type MergeResult, MerkleReqBucketMessageSchema, MerkleTree, type Message, MessageSchema, type MigrationChunkAckMessage, type MigrationChunkMessage, type MigrationCompleteMessage, type MigrationConfig, type MigrationMessage, type MigrationMetrics, type MigrationStartMessage, type MigrationStatus, type MigrationVerifyMessage, MinLengthFilter, MultiValueAttribute, NGramTokenizer, NavigableIndex, type NodeHealth, type NodeInfo, type NodeStatus, type NotOwnerError, type NotStep, ORMap, ORMapDiffRequestSchema, ORMapDiffResponseSchema, type ORMapMerkleNode, ORMapMerkleReqBucketSchema, ORMapMerkleTree, ORMapPushDiffSchema, type ORMapQueryResult, type ORMapRecord, ORMapRecordSchema, type ORMapSnapshot, ORMapSyncInitSchema, ORMapSyncRespBucketsSchema, ORMapSyncRespLeafSchema, ORMapSyncRespRootSchema, type OpAckMessage, OpAckMessageSchema, OpBatchMessageSchema, type OpRejectedMessage, OpRejectedMessageSchema, type OpResult, OpResultSchema, PARTITION_COUNT, type PNCounter, type PNCounterConfig, PNCounterImpl, type PNCounterState, type PNCounterStateObject, PNCounterStateObjectSchema, type PartitionChange, type PartitionInfo, type PartitionMap, type PartitionMapDeltaMessage, type PartitionMapMessage, type PartitionMapRequestMessage, PartitionMapRequestSchema, type PartitionMigration, type PartitionRouterConfig, PartitionState, type PendingWrite, type PermissionPolicy, type PermissionType, type PingMessage, PingMessageSchema, type PlanStep, type PongMessage, PongMessageSchema, type PredicateFn, type PredicateNode, PredicateNodeSchema, type PredicateOp, PredicateOpSchema, Predicates, type Principal, type ProcessorRateLimitConfig, type Query$1 as Query, type Query as QueryExpression, type QueryNode, QueryOptimizer, type QueryOptimizerOptions, type QueryOptions, type QueryPlan, QuerySchema, QuerySubMessageSchema, QueryUnsubMessageSchema, RESOLVER_FORBIDDEN_PATTERNS, type RegisterResolverRequest, RegisterResolverRequestSchema, type RegisterResolverResponse, RegisterResolverResponseSchema, type ReplicationAckMessage, type ReplicationBatchAckMessage, type ReplicationBatchMessage, type ReplicationConfig, type ReplicationHealth, type ReplicationLag, type ReplicationMessage, type ReplicationProtocolMessage, type ReplicationResult, type ReplicationTask, type ResolverRateLimitConfig, type ResultSet, Ringbuffer, type RoutingError, SetResultSet, SimpleAttribute, type SimpleQueryNode, SortedMap, SortedResultSet, type StaleMapError, type StandingQueryChange, StandingQueryIndex, type StandingQueryIndexOptions, StandingQueryRegistry, type StandingQueryRegistryOptions, type StandingQueryRegistryStats, StopWordFilter, SyncInitMessageSchema, SyncRespBucketsMessageSchema, SyncRespLeafMessageSchema, SyncRespRootMessageSchema, type Timestamp, TimestampSchema, type TokenFilter, TokenizationPipeline, type TokenizationPipelineOptions, type Tokenizer, TopicMessageEventSchema, TopicPubSchema, TopicSubSchema, TopicUnsubSchema, TrimFilter, UnionResultSet, type UnionStep, UniqueFilter, type UnregisterResolverRequest, UnregisterResolverRequestSchema, type UnregisterResolverResponse, UnregisterResolverResponseSchema, WRITE_CONCERN_ORDER, WhitespaceTokenizer, WordBoundaryTokenizer, WriteConcern, WriteConcernSchema, type WriteConcernValue, type WriteOptions$1 as WriteOptions, type WriteResult, combineHashes, compareHLCTimestamps, compareTimestamps, createFieldComparator, createPredicateMatcher, deepMerge, deserialize, disableNativeHash, evaluatePredicate, getHighestWriteConcernLevel, hashORMapEntry, hashORMapRecord, hashString, isLogicalQuery, isSimpleQuery, isUsingNativeHash, isWriteConcernAchieved, multiAttribute, resetNativeHash, serialize, simpleAttribute, timestampToString, validateProcessorCode, validateResolverCode };
8017
+ /**
8018
+ * Reciprocal Rank Fusion (RRF)
8019
+ *
8020
+ * Implements RRF algorithm for merging ranked results from multiple search methods.
8021
+ * Used in hybrid queries that combine exact matches, range queries, and full-text search.
8022
+ *
8023
+ * Formula: RRF_score(d) = Σ 1 / (k + rank_i(d))
8024
+ *
8025
+ * Reference: Cormack, Clarke, Buettcher (2009) - "Reciprocal Rank Fusion outperforms
8026
+ * Condorcet and individual Rank Learning Methods"
8027
+ *
8028
+ * @module search/ReciprocalRankFusion
8029
+ */
8030
+ /**
8031
+ * A ranked result from a single search method.
8032
+ */
8033
+ interface RankedResult {
8034
+ /** Unique document identifier */
8035
+ docId: string;
8036
+ /** Original score from the search method (e.g., BM25 score) */
8037
+ score: number;
8038
+ /** Source of this result: 'exact' | 'fulltext' | 'range' | custom */
8039
+ source: string;
8040
+ }
8041
+ /**
8042
+ * Configuration for RRF algorithm.
8043
+ */
8044
+ interface RRFConfig {
8045
+ /**
8046
+ * Ranking constant k.
8047
+ * Higher values reduce the impact of high rankings.
8048
+ * Default: 60 (standard value from literature)
8049
+ */
8050
+ k?: number;
8051
+ }
8052
+ /**
8053
+ * Merged result with combined RRF score.
8054
+ */
8055
+ interface MergedResult {
8056
+ /** Unique document identifier */
8057
+ docId: string;
8058
+ /** Combined RRF score */
8059
+ score: number;
8060
+ /** Combined sources (e.g., "exact+fulltext") */
8061
+ source: string;
8062
+ /** Original scores from each source */
8063
+ originalScores: Record<string, number>;
8064
+ }
8065
+ /**
8066
+ * Reciprocal Rank Fusion implementation.
8067
+ *
8068
+ * Merges results from multiple ranked lists using the RRF formula.
8069
+ * Documents appearing in multiple result sets get boosted scores.
8070
+ *
8071
+ * @example
8072
+ * ```typescript
8073
+ * const rrf = new ReciprocalRankFusion({ k: 60 });
8074
+ *
8075
+ * const exactResults = [
8076
+ * { docId: 'doc1', score: 1.0, source: 'exact' },
8077
+ * { docId: 'doc2', score: 1.0, source: 'exact' },
8078
+ * ];
8079
+ *
8080
+ * const ftsResults = [
8081
+ * { docId: 'doc2', score: 2.5, source: 'fulltext' },
8082
+ * { docId: 'doc3', score: 1.8, source: 'fulltext' },
8083
+ * ];
8084
+ *
8085
+ * const merged = rrf.merge([exactResults, ftsResults]);
8086
+ * // doc2 ranks highest (appears in both sets)
8087
+ * ```
8088
+ */
8089
+ declare class ReciprocalRankFusion {
8090
+ private readonly k;
8091
+ constructor(config?: RRFConfig);
8092
+ /**
8093
+ * Merge multiple ranked result lists using RRF.
8094
+ *
8095
+ * Formula: RRF_score(d) = Σ 1 / (k + rank_i(d))
8096
+ *
8097
+ * @param resultSets - Array of ranked result lists from different search methods
8098
+ * @returns Merged results sorted by RRF score (descending)
8099
+ */
8100
+ merge(resultSets: RankedResult[][]): MergedResult[];
8101
+ /**
8102
+ * Merge with weighted RRF for different method priorities.
8103
+ *
8104
+ * Weighted formula: RRF_score(d) = Σ weight_i * (1 / (k + rank_i(d)))
8105
+ *
8106
+ * @param resultSets - Array of ranked result lists
8107
+ * @param weights - Weights for each result set (same order as resultSets)
8108
+ * @returns Merged results sorted by weighted RRF score (descending)
8109
+ *
8110
+ * @example
8111
+ * ```typescript
8112
+ * const rrf = new ReciprocalRankFusion();
8113
+ *
8114
+ * // Prioritize exact matches (weight 2.0) over FTS (weight 1.0)
8115
+ * const merged = rrf.mergeWeighted(
8116
+ * [exactResults, ftsResults],
8117
+ * [2.0, 1.0]
8118
+ * );
8119
+ * ```
8120
+ */
8121
+ mergeWeighted(resultSets: RankedResult[][], weights: number[]): MergedResult[];
8122
+ /**
8123
+ * Get the k constant used for RRF calculation.
8124
+ */
8125
+ getK(): number;
8126
+ }
8127
+
8128
+ export { type Attribute, AuthMessageSchema, type BM25Options, BM25Scorer, type BatchMessage, BatchMessageSchema, BuiltInProcessors, BuiltInResolvers, type CircuitBreakerConfig, type ClientOp, ClientOpMessageSchema, ClientOpSchema, type ClusterClientConfig, type ClusterEvents, type ReadOptions as ClusterReadOptions, type WriteOptions as ClusterWriteOptions, type CompareFn, type ConflictResolver, type ConflictResolverDef, ConflictResolverDefSchema, type ConflictResolverFn, ConflictResolverSchema, type ConnectionPoolConfig, type ConnectionState, ConsistencyLevel, CounterRequestSchema, CounterResponseSchema, CounterSyncSchema, CounterUpdateSchema, DEFAULT_BACKUP_COUNT, DEFAULT_CIRCUIT_BREAKER_CONFIG, DEFAULT_CONNECTION_POOL_CONFIG, DEFAULT_EVENT_JOURNAL_CONFIG, DEFAULT_MIGRATION_CONFIG, DEFAULT_PARTITION_ROUTER_CONFIG, DEFAULT_PROCESSOR_RATE_LIMITS, DEFAULT_REPLICATION_CONFIG, DEFAULT_RESOLVER_RATE_LIMITS, DEFAULT_STOP_WORDS, DEFAULT_WRITE_CONCERN_TIMEOUT, ENGLISH_STOPWORDS, type EntryProcessBatchRequest, EntryProcessBatchRequestSchema, type EntryProcessBatchResponse, EntryProcessBatchResponseSchema, type EntryProcessKeyResult, EntryProcessKeyResultSchema, type EntryProcessRequest, EntryProcessRequestSchema, type EntryProcessResponse, EntryProcessResponseSchema, type EntryProcessorDef, EntryProcessorDefSchema, type EntryProcessorFn, type EntryProcessorResult, EntryProcessorSchema, type EventJournal, type EventJournalConfig, EventJournalImpl, FORBIDDEN_PATTERNS, BM25InvertedIndex as FTSInvertedIndex, type SearchOptions as FTSSearchOptions, type SearchResult as FTSSearchResult, BM25Tokenizer as FTSTokenizer, type TokenizerOptions as FTSTokenizerOptions, FallbackIndex, type FilterStep, FilteringResultSet, type FullScanStep, FullTextIndex, type FullTextIndexConfig, HLC, HashIndex, type Index, type IndexQuery, IndexRegistry, type IndexRegistryStats, type IndexScanStep, type IndexStats, IndexedLWWMap, IndexedORMap, IntersectionResultSet, type IntersectionStep, InvertedIndex, type InvertedIndexStats, type IteratorFactory, type JournalEvent, type JournalEventData, JournalEventDataSchema, type JournalEventInput, type JournalEventListener, type JournalEventMessage, JournalEventMessageSchema, type JournalEventType, JournalEventTypeSchema, type JournalReadRequest, JournalReadRequestSchema, type JournalReadResponse, JournalReadResponseSchema, type JournalSubscribeRequest, JournalSubscribeRequestSchema, type JournalUnsubscribeRequest, JournalUnsubscribeRequestSchema, LWWMap, type LWWRecord, LWWRecordSchema, LazyResultSet, LimitResultSet, type ListResolversRequest, ListResolversRequestSchema, type ListResolversResponse, ListResolversResponseSchema, type LiveQueryCallback, type LiveQueryDeltaEvent, type LiveQueryEvent, type LiveQueryInitialEvent, LiveQueryManager, type LiveQueryManagerOptions, type LiveQueryManagerStats, LockReleaseSchema, LockRequestSchema, type LogicalQueryNode, LowercaseFilter, type MatchOptions, MaxLengthFilter, type MergeContext, type MergeKeyResult, type MergeRejectedMessage, MergeRejectedMessageSchema, type MergeRejection, type MergeResult, type MergedResult, MerkleReqBucketMessageSchema, MerkleTree, type Message, MessageSchema, type MigrationChunkAckMessage, type MigrationChunkMessage, type MigrationCompleteMessage, type MigrationConfig, type MigrationMessage, type MigrationMetrics, type MigrationStartMessage, type MigrationStatus, type MigrationVerifyMessage, MinLengthFilter, MultiValueAttribute, NGramTokenizer, NavigableIndex, type NodeHealth, type NodeInfo, type NodeStatus, type NotOwnerError, type NotStep, ORMap, ORMapDiffRequestSchema, ORMapDiffResponseSchema, type ORMapMerkleNode, ORMapMerkleReqBucketSchema, ORMapMerkleTree, ORMapPushDiffSchema, type ORMapQueryResult, type ORMapRecord, ORMapRecordSchema, type ORMapSearchResult, type ORMapSnapshot, ORMapSyncInitSchema, ORMapSyncRespBucketsSchema, ORMapSyncRespLeafSchema, ORMapSyncRespRootSchema, type OpAckMessage, OpAckMessageSchema, OpBatchMessageSchema, type OpRejectedMessage, OpRejectedMessageSchema, type OpResult, OpResultSchema, PARTITION_COUNT, type PNCounter, type PNCounterConfig, PNCounterImpl, type PNCounterState, type PNCounterStateObject, PNCounterStateObjectSchema, type PartitionChange, type PartitionInfo, type PartitionMap, type PartitionMapDeltaMessage, type PartitionMapMessage, type PartitionMapRequestMessage, PartitionMapRequestSchema, type PartitionMigration, type PartitionRouterConfig, PartitionState, type PendingWrite, type PermissionPolicy, type PermissionType, type PingMessage, PingMessageSchema, type PlanStep, type PongMessage, PongMessageSchema, type Posting, type PredicateFn, type PredicateNode, PredicateNodeSchema, type PredicateOp, PredicateOpSchema, Predicates, type Principal, type ProcessorRateLimitConfig, type Query$1 as Query, type Query as QueryExpression, type QueryNode, QueryOptimizer, type QueryOptimizerOptions, type QueryOptions, type QueryPlan, QuerySchema, QuerySubMessageSchema, QueryUnsubMessageSchema, RESOLVER_FORBIDDEN_PATTERNS, type RRFConfig, type RankedResult, ReciprocalRankFusion, type RegisterResolverRequest, RegisterResolverRequestSchema, type RegisterResolverResponse, RegisterResolverResponseSchema, type ReplicationAckMessage, type ReplicationBatchAckMessage, type ReplicationBatchMessage, type ReplicationConfig, type ReplicationHealth, type ReplicationLag, type ReplicationMessage, type ReplicationProtocolMessage, type ReplicationResult, type ReplicationTask, type ResolverRateLimitConfig, type ResultSet, Ringbuffer, type RoutingError, type ScoredDocument, type SearchMessage, SearchMessageSchema, type SearchOptions$1 as SearchOptions, SearchOptionsSchema, type SearchPayload, SearchPayloadSchema, type SearchRespMessage, SearchRespMessageSchema, type SearchRespPayload, SearchRespPayloadSchema, type SearchSubMessage, SearchSubMessageSchema, type SearchSubPayload, SearchSubPayloadSchema, type SearchUnsubMessage, SearchUnsubMessageSchema, type SearchUnsubPayload, SearchUnsubPayloadSchema, type SearchUpdateMessage, SearchUpdateMessageSchema, type SearchUpdatePayload, SearchUpdatePayloadSchema, type SearchUpdateType, SearchUpdateTypeSchema, type SerializedIndex, SetResultSet, SimpleAttribute, type SimpleQueryNode, SortedMap, SortedResultSet, type StaleMapError, type StandingQueryChange, StandingQueryIndex, type StandingQueryIndexOptions, StandingQueryRegistry, type StandingQueryRegistryOptions, type StandingQueryRegistryStats, StopWordFilter, SyncInitMessageSchema, SyncRespBucketsMessageSchema, SyncRespLeafMessageSchema, SyncRespRootMessageSchema, type TermInfo, type Timestamp, TimestampSchema, type TokenFilter, TokenizationPipeline, type TokenizationPipelineOptions, type Tokenizer, TopicMessageEventSchema, TopicPubSchema, TopicSubSchema, TopicUnsubSchema, TrimFilter, UnionResultSet, type UnionStep, UniqueFilter, type UnregisterResolverRequest, UnregisterResolverRequestSchema, type UnregisterResolverResponse, UnregisterResolverResponseSchema, WRITE_CONCERN_ORDER, WhitespaceTokenizer, WordBoundaryTokenizer, WriteConcern, WriteConcernSchema, type WriteConcernValue, type WriteOptions$1 as WriteOptions, type WriteResult, combineHashes, compareHLCTimestamps, compareTimestamps, createFieldComparator, createPredicateMatcher, deepMerge, deserialize, disableNativeHash, evaluatePredicate, getHighestWriteConcernLevel, hashORMapEntry, hashORMapRecord, hashString, isLogicalQuery, isSimpleQuery, isUsingNativeHash, isWriteConcernAchieved, multiAttribute, porterStem, resetNativeHash, serialize, simpleAttribute, timestampToString, validateProcessorCode, validateResolverCode };