@memberjunction/search-engine 6.1.0-edge.1 → 6.1.0-edge.3
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/LICENSE +180 -4
- package/dist/generic/EntitySearchProvider.d.ts +20 -7
- package/dist/generic/EntitySearchProvider.d.ts.map +1 -1
- package/dist/generic/EntitySearchProvider.js +26 -13
- package/dist/generic/EntitySearchProvider.js.map +1 -1
- package/dist/generic/FullTextSearchProvider.d.ts +3 -1
- package/dist/generic/FullTextSearchProvider.d.ts.map +1 -1
- package/dist/generic/FullTextSearchProvider.js +5 -2
- package/dist/generic/FullTextSearchProvider.js.map +1 -1
- package/dist/generic/SearchEngine.d.ts +15 -3
- package/dist/generic/SearchEngine.d.ts.map +1 -1
- package/dist/generic/SearchEngine.js +45 -10
- package/dist/generic/SearchEngine.js.map +1 -1
- package/dist/generic/VectorSearchProvider.d.ts +94 -0
- package/dist/generic/VectorSearchProvider.d.ts.map +1 -1
- package/dist/generic/VectorSearchProvider.js +258 -9
- package/dist/generic/VectorSearchProvider.js.map +1 -1
- package/dist/generic/env-config.d.ts +19 -0
- package/dist/generic/env-config.d.ts.map +1 -0
- package/dist/generic/env-config.js +36 -0
- package/dist/generic/env-config.js.map +1 -0
- package/package.json +9 -9
package/LICENSE
CHANGED
|
@@ -1,7 +1,183 @@
|
|
|
1
|
-
|
|
1
|
+
Business Source License 1.1
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
License text copyright (c) 2024 MariaDB plc, All Rights Reserved.
|
|
4
|
+
"Business Source License" is a trademark of MariaDB plc.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
-----------------------------------------------------------------------------
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
Parameters
|
|
9
|
+
|
|
10
|
+
Licensor: Blue Cypress, Inc.
|
|
11
|
+
|
|
12
|
+
Licensed Work: MemberJunction.
|
|
13
|
+
The Licensed Work is (c) 2023-2026 Blue Cypress, Inc.
|
|
14
|
+
|
|
15
|
+
Additional Use Grant: Subject to the terms of this License, Licensor grants
|
|
16
|
+
you the following additional rights to make Production
|
|
17
|
+
Use of the Licensed Work.
|
|
18
|
+
|
|
19
|
+
1. Internal Use
|
|
20
|
+
|
|
21
|
+
You may make production use of the Licensed Work for
|
|
22
|
+
your own internal business or organizational operations.
|
|
23
|
+
|
|
24
|
+
2. Nonprofit Use
|
|
25
|
+
|
|
26
|
+
If you are a Nonprofit, you may make production use of
|
|
27
|
+
the Licensed Work for the operations and activities of
|
|
28
|
+
your Organizational Family.
|
|
29
|
+
|
|
30
|
+
3. MemberJunction Certified Program Use
|
|
31
|
+
|
|
32
|
+
If you are authorized by Licensor under the
|
|
33
|
+
MemberJunction Certified Program to provide professional
|
|
34
|
+
services using the Licensed Work, you may make
|
|
35
|
+
production use of the Licensed Work in providing such
|
|
36
|
+
professional services to a client, provided that:
|
|
37
|
+
|
|
38
|
+
(a) the Licensed Work is deployed in, and the applicable
|
|
39
|
+
production use occurs within, an environment owned,
|
|
40
|
+
leased, licensed, subscribed to, or otherwise controlled
|
|
41
|
+
by that client; and
|
|
42
|
+
|
|
43
|
+
(b) the production use is for that client's own internal
|
|
44
|
+
business or organizational operations or is otherwise
|
|
45
|
+
independently permitted to that client under this
|
|
46
|
+
Additional Use Grant.
|
|
47
|
+
|
|
48
|
+
4. Definitions Applicable to the Additional Use Grant
|
|
49
|
+
|
|
50
|
+
"Affiliate" means, with respect to a specified Person,
|
|
51
|
+
any other Person that directly or indirectly Controls,
|
|
52
|
+
is Controlled by, or is under common Control with such
|
|
53
|
+
specified Person.
|
|
54
|
+
|
|
55
|
+
"Control" (including the terms "Controls," "Controlled
|
|
56
|
+
by," and "under common Control with") means the direct
|
|
57
|
+
or indirect possession of the power to direct or cause
|
|
58
|
+
the direction of the management and policies of a
|
|
59
|
+
Person, whether through ownership of voting interests,
|
|
60
|
+
by contract, or otherwise.
|
|
61
|
+
|
|
62
|
+
"Organizational Family" means, with respect to a Person,
|
|
63
|
+
(a) such Person and its Affiliates, and (b) any
|
|
64
|
+
nonprofit organization, governmental entity, chapter,
|
|
65
|
+
division, local affiliate, regional affiliate, state
|
|
66
|
+
affiliate, national affiliate, or other entity that is
|
|
67
|
+
formally affiliated with such Person through governing
|
|
68
|
+
documents, a charter, bylaws, a membership agreement, or
|
|
69
|
+
another written organizational instrument, and is
|
|
70
|
+
recognized under such documents as part of the same
|
|
71
|
+
organizational structure.
|
|
72
|
+
|
|
73
|
+
"Nonprofit" means a Person recognized by the Internal
|
|
74
|
+
Revenue Service as exempt from federal income taxation
|
|
75
|
+
under Section 501(c)(3), 501(c)(4), 501(c)(5), or
|
|
76
|
+
501(c)(6) of the Internal Revenue Code, or a foreign
|
|
77
|
+
organization recognized under substantially equivalent
|
|
78
|
+
laws.
|
|
79
|
+
|
|
80
|
+
A Person claiming eligibility as a Nonprofit shall, upon
|
|
81
|
+
Licensor's reasonable request, provide documentation
|
|
82
|
+
reasonably sufficient to demonstrate that it qualifies
|
|
83
|
+
as a Nonprofit. If such Person materially misrepresents,
|
|
84
|
+
or is unable to demonstrate, its qualification as a
|
|
85
|
+
Nonprofit, the rights granted to such Person under
|
|
86
|
+
Section 2 of this Additional Use Grant shall terminate.
|
|
87
|
+
|
|
88
|
+
"MemberJunction Certified Program" means Licensor's
|
|
89
|
+
then-current program for certifying and authorizing a
|
|
90
|
+
Person to provide professional services using the
|
|
91
|
+
Licensed Work.
|
|
92
|
+
|
|
93
|
+
"Person" means any individual, corporation, limited
|
|
94
|
+
liability company, partnership, association, nonprofit
|
|
95
|
+
organization, governmental entity, or other legal or
|
|
96
|
+
organizational entity.
|
|
97
|
+
|
|
98
|
+
Change Date: Four (4) years from the date the Licensed Work is first
|
|
99
|
+
made available.
|
|
100
|
+
|
|
101
|
+
Change License: MIT License.
|
|
102
|
+
|
|
103
|
+
For information about alternative licensing arrangements for the Licensed
|
|
104
|
+
Work, please contact Blue Cypress, Inc.
|
|
105
|
+
|
|
106
|
+
-----------------------------------------------------------------------------
|
|
107
|
+
|
|
108
|
+
Terms
|
|
109
|
+
|
|
110
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
111
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
112
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
113
|
+
production use.
|
|
114
|
+
|
|
115
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
116
|
+
available distribution of a specific version of the Licensed Work under this
|
|
117
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
118
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
119
|
+
above terminate.
|
|
120
|
+
|
|
121
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
122
|
+
currently in effect as described in this License, you must purchase a
|
|
123
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
124
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
125
|
+
|
|
126
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
127
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
128
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
129
|
+
for each version of the Licensed Work released by Licensor.
|
|
130
|
+
|
|
131
|
+
You must conspicuously display this License on each original or modified copy
|
|
132
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
133
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
134
|
+
License apply to your use of that work.
|
|
135
|
+
|
|
136
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
137
|
+
terminate your rights under this License for the current and all other
|
|
138
|
+
versions of the Licensed Work.
|
|
139
|
+
|
|
140
|
+
This License does not grant you any right in any trademark or logo of
|
|
141
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
142
|
+
Licensor as expressly required by this License).
|
|
143
|
+
|
|
144
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
145
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
146
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
147
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
148
|
+
TITLE.
|
|
149
|
+
|
|
150
|
+
MariaDB hereby grants you permission to use this License's text to license
|
|
151
|
+
your works, and to refer to it using the trademark "Business Source License",
|
|
152
|
+
as long as you comply with the Covenants of Licensor below.
|
|
153
|
+
|
|
154
|
+
-----------------------------------------------------------------------------
|
|
155
|
+
|
|
156
|
+
Covenants of Licensor
|
|
157
|
+
|
|
158
|
+
In consideration of the right to use this License's text and the "Business
|
|
159
|
+
Source License" name and trademark, Licensor covenants to MariaDB, and to all
|
|
160
|
+
other recipients of the licensed work to be provided by Licensor:
|
|
161
|
+
|
|
162
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
163
|
+
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
164
|
+
where "compatible" means that software provided under the Change License
|
|
165
|
+
can be included in a program with software provided under GPL Version 2.0
|
|
166
|
+
or a later version. Licensor may specify additional Change Licenses without
|
|
167
|
+
limitation.
|
|
168
|
+
|
|
169
|
+
2. To either: (a) specify an additional grant of rights to use that does not
|
|
170
|
+
impose any additional restriction on the right granted in this License, as
|
|
171
|
+
the Additional Use Grant; or (b) insert the text "None".
|
|
172
|
+
|
|
173
|
+
3. To specify a Change Date.
|
|
174
|
+
|
|
175
|
+
4. Not to modify this License in any other way.
|
|
176
|
+
|
|
177
|
+
-----------------------------------------------------------------------------
|
|
178
|
+
|
|
179
|
+
Notice
|
|
180
|
+
|
|
181
|
+
The Business Source License (this document, or the "License") is not an Open
|
|
182
|
+
Source license. However, the Licensed Work will eventually be made available
|
|
183
|
+
under an Open Source License, as stated in this License.
|
|
@@ -34,16 +34,29 @@ export declare class EntitySearchProvider extends BaseSearchProvider {
|
|
|
34
34
|
* many candidates; the engine still trims the fused, relevance-sorted result set back to
|
|
35
35
|
* `topK`, so the returned count is unchanged — we only widen the candidate pool per entity.
|
|
36
36
|
* Public + static so a deployment can tune it at startup (larger entity counts may lower it
|
|
37
|
-
* to bound the row-materialization cost of the parallel fan-out)
|
|
37
|
+
* to bound the row-materialization cost of the parallel fan-out), or override the default at
|
|
38
|
+
* process start via the `MJ_SEARCH_PER_ENTITY_FETCH_DEPTH` environment variable.
|
|
38
39
|
*/
|
|
39
40
|
static PerEntityFetchDepth: number;
|
|
40
41
|
/**
|
|
41
|
-
* Per-entity hard timeout. If one entity's RunView
|
|
42
|
-
* we drop its results rather than hold the entire fan-out hostage. The
|
|
43
|
-
* keeps running in SQL Server until completion (we can't cancel mssql
|
|
44
|
-
* here), but other entities' results still land for the user.
|
|
42
|
+
* Per-entity hard timeout, in milliseconds. If one entity's RunView takes longer
|
|
43
|
+
* than this, we drop its results rather than hold the entire fan-out hostage. The
|
|
44
|
+
* query keeps running in SQL Server until completion (we can't cancel mssql
|
|
45
|
+
* Requests here), but the other entities' results still land for the user.
|
|
46
|
+
*
|
|
47
|
+
* Public + static so a deployment can tune it at startup — mirroring
|
|
48
|
+
* {@link PerEntityFetchDepth}. The 3s default keeps interactive/omnibar fan-outs
|
|
49
|
+
* responsive by dropping a pathological entity promptly instead of stalling the
|
|
50
|
+
* whole fan-out; deployments doing large unindexed LIKE scans can raise it, either
|
|
51
|
+
* by overriding the default at process start via the `MJ_SEARCH_PER_ENTITY_TIMEOUT_MS`
|
|
52
|
+
* environment variable or by assigning the static before serving:
|
|
53
|
+
*
|
|
54
|
+
* ```ts
|
|
55
|
+
* import { EntitySearchProvider } from '@memberjunction/search-engine';
|
|
56
|
+
* EntitySearchProvider.PerEntityTimeoutMS = 30_000;
|
|
57
|
+
* ```
|
|
45
58
|
*/
|
|
46
|
-
|
|
59
|
+
static PerEntityTimeoutMS: number;
|
|
47
60
|
/**
|
|
48
61
|
* Execute an entity search across all entities with AllowUserSearchAPI=true.
|
|
49
62
|
*
|
|
@@ -69,7 +82,7 @@ export declare class EntitySearchProvider extends BaseSearchProvider {
|
|
|
69
82
|
private getSearchableEntities;
|
|
70
83
|
/**
|
|
71
84
|
* Search a single entity using RunView with UserSearchString. Wraps the
|
|
72
|
-
* underlying RunView in a hard
|
|
85
|
+
* underlying RunView in a hard PerEntityTimeoutMS timeout so a slow
|
|
73
86
|
* entity cannot hold up the whole fan-out — partial results from the
|
|
74
87
|
* other entities still land.
|
|
75
88
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntitySearchProvider.d.ts","sourceRoot":"","sources":["../../src/generic/EntitySearchProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAmD,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAoB,gBAAgB,EAAyB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"EntitySearchProvider.d.ts","sourceRoot":"","sources":["../../src/generic/EntitySearchProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAmD,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAoB,gBAAgB,EAAyB,MAAM,gBAAgB,CAAC;AAG1I;;;;GAIG;AACH,qBACa,oBAAqB,SAAQ,kBAAkB;IACxD,SAAgB,UAAU,EAAE,YAAY,CAAY;IAEpD;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAK;IAE5C;;;;;;;;;;;OAWG;IACH,OAAc,mBAAmB,SAA0D;IAE3F;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAc,kBAAkB,SAA2D;IAE3F;;;;;;;;OAQG;IACU,MAAM,CACf,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,aAAa,GAAG,SAAS,EAClC,WAAW,EAAE,QAAQ,EACrB,gBAAgB,CAAC,EAAE,gBAAgB,GACpC,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAmF9B;;;;;;;OAOG;IACH,OAAO,CAAC,qBAAqB;IAoB7B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAc7B;;;;;;;;;OASG;YACW,eAAe;YAsBf,kBAAkB;IA8BhC;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAwDtB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAmCpB;;OAEG;IACH,OAAO,CAAC,cAAc;IAetB;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,wBAAwB;CAGnC"}
|
|
@@ -17,6 +17,7 @@ var EntitySearchProvider_1;
|
|
|
17
17
|
import { LogError, LogStatus, RunView } from '@memberjunction/core';
|
|
18
18
|
import { RegisterClass } from '@memberjunction/global';
|
|
19
19
|
import { BaseSearchProvider } from './ISearchProvider.js';
|
|
20
|
+
import { envIntOverride } from './env-config.js';
|
|
20
21
|
/**
|
|
21
22
|
* Provides entity-level LIKE-based search using RunView + UserSearchString.
|
|
22
23
|
* Searches all entities where AllowUserSearchAPI=true, returning results
|
|
@@ -45,16 +46,29 @@ let EntitySearchProvider = class EntitySearchProvider extends BaseSearchProvider
|
|
|
45
46
|
* many candidates; the engine still trims the fused, relevance-sorted result set back to
|
|
46
47
|
* `topK`, so the returned count is unchanged — we only widen the candidate pool per entity.
|
|
47
48
|
* Public + static so a deployment can tune it at startup (larger entity counts may lower it
|
|
48
|
-
* to bound the row-materialization cost of the parallel fan-out)
|
|
49
|
+
* to bound the row-materialization cost of the parallel fan-out), or override the default at
|
|
50
|
+
* process start via the `MJ_SEARCH_PER_ENTITY_FETCH_DEPTH` environment variable.
|
|
49
51
|
*/
|
|
50
|
-
static { this.PerEntityFetchDepth = 15; }
|
|
52
|
+
static { this.PerEntityFetchDepth = envIntOverride('MJ_SEARCH_PER_ENTITY_FETCH_DEPTH', 15); }
|
|
51
53
|
/**
|
|
52
|
-
* Per-entity hard timeout. If one entity's RunView
|
|
53
|
-
* we drop its results rather than hold the entire fan-out hostage. The
|
|
54
|
-
* keeps running in SQL Server until completion (we can't cancel mssql
|
|
55
|
-
* here), but other entities' results still land for the user.
|
|
54
|
+
* Per-entity hard timeout, in milliseconds. If one entity's RunView takes longer
|
|
55
|
+
* than this, we drop its results rather than hold the entire fan-out hostage. The
|
|
56
|
+
* query keeps running in SQL Server until completion (we can't cancel mssql
|
|
57
|
+
* Requests here), but the other entities' results still land for the user.
|
|
58
|
+
*
|
|
59
|
+
* Public + static so a deployment can tune it at startup — mirroring
|
|
60
|
+
* {@link PerEntityFetchDepth}. The 3s default keeps interactive/omnibar fan-outs
|
|
61
|
+
* responsive by dropping a pathological entity promptly instead of stalling the
|
|
62
|
+
* whole fan-out; deployments doing large unindexed LIKE scans can raise it, either
|
|
63
|
+
* by overriding the default at process start via the `MJ_SEARCH_PER_ENTITY_TIMEOUT_MS`
|
|
64
|
+
* environment variable or by assigning the static before serving:
|
|
65
|
+
*
|
|
66
|
+
* ```ts
|
|
67
|
+
* import { EntitySearchProvider } from '@memberjunction/search-engine';
|
|
68
|
+
* EntitySearchProvider.PerEntityTimeoutMS = 30_000;
|
|
69
|
+
* ```
|
|
56
70
|
*/
|
|
57
|
-
static { this.
|
|
71
|
+
static { this.PerEntityTimeoutMS = envIntOverride('MJ_SEARCH_PER_ENTITY_TIMEOUT_MS', 3000); }
|
|
58
72
|
/**
|
|
59
73
|
* Execute an entity search across all entities with AllowUserSearchAPI=true.
|
|
60
74
|
*
|
|
@@ -113,9 +127,8 @@ let EntitySearchProvider = class EntitySearchProvider extends BaseSearchProvider
|
|
|
113
127
|
// capped at topK anyway); the fused set is relevance-sorted and sliced to topK below.
|
|
114
128
|
const perEntityLimit = Math.min(topK, Math.max(EntitySearchProvider_1.PerEntityFetchDepth, Math.ceil(topK / Math.max(1, scoped.length))));
|
|
115
129
|
// Search all entities in parallel, threading per-entity ExtraFilter + UserSearchString
|
|
116
|
-
// override; each call is gated by a hard
|
|
117
|
-
//
|
|
118
|
-
// entities still land.
|
|
130
|
+
// override; each call is gated by a hard PerEntityTimeoutMS timeout so a slow entity
|
|
131
|
+
// cannot hold up the whole fan-out — partial results from the other entities still land.
|
|
119
132
|
const searchPromises = scoped.map(item => this.searchOneEntity(item.EntityName, item.UserSearchString ?? effectiveQuery, perEntityLimit, contextUser, item.ExtraFilter));
|
|
120
133
|
const results = await Promise.all(searchPromises);
|
|
121
134
|
// Re-score against the original query for field-match relevance (not the transform)
|
|
@@ -166,7 +179,7 @@ let EntitySearchProvider = class EntitySearchProvider extends BaseSearchProvider
|
|
|
166
179
|
}
|
|
167
180
|
/**
|
|
168
181
|
* Search a single entity using RunView with UserSearchString. Wraps the
|
|
169
|
-
* underlying RunView in a hard
|
|
182
|
+
* underlying RunView in a hard PerEntityTimeoutMS timeout so a slow
|
|
170
183
|
* entity cannot hold up the whole fan-out — partial results from the
|
|
171
184
|
* other entities still land.
|
|
172
185
|
*
|
|
@@ -179,9 +192,9 @@ let EntitySearchProvider = class EntitySearchProvider extends BaseSearchProvider
|
|
|
179
192
|
let timer;
|
|
180
193
|
const timeout = new Promise(resolve => {
|
|
181
194
|
timer = setTimeout(() => {
|
|
182
|
-
LogError(`EntitySearchProvider: timeout (${EntitySearchProvider_1.
|
|
195
|
+
LogError(`EntitySearchProvider: timeout (${EntitySearchProvider_1.PerEntityTimeoutMS}ms) searching "${entityName}"`);
|
|
183
196
|
resolve([]);
|
|
184
|
-
}, EntitySearchProvider_1.
|
|
197
|
+
}, EntitySearchProvider_1.PerEntityTimeoutMS);
|
|
185
198
|
});
|
|
186
199
|
try {
|
|
187
200
|
return await Promise.race([work, timeout]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntitySearchProvider.js","sourceRoot":"","sources":["../../src/generic/EntitySearch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,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;YAClE,CAAC;QACL,CAAC;QAED,OAAO,UAAU,CAAC,CAAC,CAAC,cAAc,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC;IAC3E,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACK,wBAAwB,CAAC,KAAa;QAC1C,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAChD,CAAC;;AApYQ,oBAAoB;IADhC,aAAa,CAAC,kBAAkB,EAAE,sBAAsB,CAAC;GAC7C,oBAAoB,CAqYhC"}
|
|
@@ -28,7 +28,9 @@ export declare class FullTextSearchProvider extends BaseSearchProvider {
|
|
|
28
28
|
* Rows to fetch PER ENTITY as the ranking candidate pool — decoupled from the global `topK`
|
|
29
29
|
* budget (bug C3). Previously `topK / 10`, which capped every FTS entity to a tiny arbitrary
|
|
30
30
|
* slice regardless of how many entities matched. The engine still trims the fused set to topK.
|
|
31
|
-
* Public + static so a deployment can tune it at startup
|
|
31
|
+
* Public + static so a deployment can tune it at startup, or override the default at process
|
|
32
|
+
* start via the `MJ_SEARCH_FULLTEXT_PER_ENTITY_FETCH_DEPTH` environment variable. Mirrors
|
|
33
|
+
* EntitySearchProvider.
|
|
32
34
|
*/
|
|
33
35
|
static PerEntityFetchDepth: number;
|
|
34
36
|
private enricher;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FullTextSearchProvider.d.ts","sourceRoot":"","sources":["../../src/generic/FullTextSearchProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAA8B,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE5E,OAAO,EAAE,kBAAkB,EAAwB,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAoB,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACnH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"FullTextSearchProvider.d.ts","sourceRoot":"","sources":["../../src/generic/FullTextSearchProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAA8B,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE5E,OAAO,EAAE,kBAAkB,EAAwB,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAoB,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACnH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;;GAGG;AACH,qBACa,sBAAuB,SAAQ,kBAAkB;IAC1D,SAAgB,UAAU,EAAE,YAAY,CAAc;IAEtD;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAK;IAE5C;;;;;;;OAOG;IACH,OAAc,mBAAmB,SAAmE;IAEpG,OAAO,CAAC,QAAQ,CAA+B;IAE/C,4EAA4E;IACrE,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAIlD;;;;;;;;OAQG;IACU,MAAM,CACf,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,aAAa,GAAG,SAAS,EAClC,WAAW,EAAE,QAAQ,EACrB,gBAAgB,CAAC,EAAE,gBAAgB,GACpC,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAgEjC"}
|
|
@@ -18,6 +18,7 @@ var FullTextSearchProvider_1;
|
|
|
18
18
|
import { LogError } from '@memberjunction/core';
|
|
19
19
|
import { RegisterClass } from '@memberjunction/global';
|
|
20
20
|
import { BaseSearchProvider } from './ISearchProvider.js';
|
|
21
|
+
import { envIntOverride } from './env-config.js';
|
|
21
22
|
/**
|
|
22
23
|
* Provides full-text search using the MJ Metadata.FullTextSearch() method.
|
|
23
24
|
* Always available since it relies on the standard MJ provider infrastructure.
|
|
@@ -39,9 +40,11 @@ let FullTextSearchProvider = class FullTextSearchProvider extends BaseSearchProv
|
|
|
39
40
|
* Rows to fetch PER ENTITY as the ranking candidate pool — decoupled from the global `topK`
|
|
40
41
|
* budget (bug C3). Previously `topK / 10`, which capped every FTS entity to a tiny arbitrary
|
|
41
42
|
* slice regardless of how many entities matched. The engine still trims the fused set to topK.
|
|
42
|
-
* Public + static so a deployment can tune it at startup
|
|
43
|
+
* Public + static so a deployment can tune it at startup, or override the default at process
|
|
44
|
+
* start via the `MJ_SEARCH_FULLTEXT_PER_ENTITY_FETCH_DEPTH` environment variable. Mirrors
|
|
45
|
+
* EntitySearchProvider.
|
|
43
46
|
*/
|
|
44
|
-
static { this.PerEntityFetchDepth = 15; }
|
|
47
|
+
static { this.PerEntityFetchDepth = envIntOverride('MJ_SEARCH_FULLTEXT_PER_ENTITY_FETCH_DEPTH', 15); }
|
|
45
48
|
/** Set the enricher instance. Called by SearchEngine after construction. */
|
|
46
49
|
SetEnricher(enricher) {
|
|
47
50
|
this.enricher = enricher;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FullTextSearchProvider.js","sourceRoot":"","sources":["../../src/generic/FullTextSearchProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;;;;;;;;AAEH,OAAO,EAAoB,QAAQ,EAAY,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAwB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"FullTextSearchProvider.js","sourceRoot":"","sources":["../../src/generic/FullTextSearchProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;;;;;;;;AAEH,OAAO,EAAoB,QAAQ,EAAY,MAAM,sBAAs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I,CAAC,QAAQ,EAAE,CAAC;gBAChB,MAAM,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;gBAEzD,gCAAgC;gBAChC,IAAI,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oBACxB,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;gBAC7D,CAAC;YACL,CAAC;YAED,OAAO,OAAO,CAAC;QACnB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,GAAG,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnE,QAAQ,CAAC,mDAAmD,GAAG,EAAE,CAAC,CAAC;YACnE,OAAO,EAAE,CAAC;QACd,CAAC;IACL,CAAC;;AAzGQ,sBAAsB;IADlC,aAAa,CAAC,kBAAkB,EAAE,wBAAwB,CAAC;GAC/C,sBAAsB,CA0GlC"}
|
|
@@ -447,10 +447,22 @@ export declare class SearchEngine extends BaseSingleton<SearchEngine> {
|
|
|
447
447
|
*/
|
|
448
448
|
private filterEntityResults;
|
|
449
449
|
/**
|
|
450
|
-
*
|
|
451
|
-
*
|
|
450
|
+
* Lanes whose results are self-evidently records of the entity they are labelled with, because the
|
|
451
|
+
* provider obtained them by querying that entity through `RunView`. Everything else — the vector
|
|
452
|
+
* lane, and any 3rd-party provider keyed by its own `SourceType` — carries a label supplied by
|
|
453
|
+
* whatever populated the index, and must be verified before its permissions are trusted.
|
|
454
|
+
*
|
|
455
|
+
* An allowlist rather than a denylist on purpose: a `SourceType` nobody anticipated is verified by
|
|
456
|
+
* default instead of trusted by default.
|
|
457
|
+
*/
|
|
458
|
+
private static readonly LanesWithSelfEvidentOwnership;
|
|
459
|
+
/**
|
|
460
|
+
* Use RunView to confirm the results really are records of `entity`, and — when a row filter is
|
|
461
|
+
* supplied — that the user may see them.
|
|
462
|
+
* Only results whose record IDs come back are added to `permitted`, so a result whose id is not a
|
|
463
|
+
* record of this entity is dropped whether or not a row filter exists.
|
|
452
464
|
*/
|
|
453
|
-
private
|
|
465
|
+
private verifyOwnershipAndRowFilters;
|
|
454
466
|
/** Build an error SearchResult */
|
|
455
467
|
/**
|
|
456
468
|
* Public hook for callers (e.g. the GraphQL resolver) to emit a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchEngine.d.ts","sourceRoot":"","sources":["../../src/generic/SearchEngine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAoC,iBAAiB,EAA0C,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC7I,OAAO,EACH,gBAAgB,EAOnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,aAAa,EAAuC,MAAM,wBAAwB,CAAC;AAC5F,OAAO,EACH,YAAY,EACZ,YAAY,
|
|
1
|
+
{"version":3,"file":"SearchEngine.d.ts","sourceRoot":"","sources":["../../src/generic/SearchEngine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAoC,iBAAiB,EAA0C,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC7I,OAAO,EACH,gBAAgB,EAOnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,aAAa,EAAuC,MAAM,wBAAwB,CAAC;AAC5F,OAAO,EACH,YAAY,EACZ,YAAY,EAEZ,gBAAgB,EAChB,iBAAiB,EAUjB,eAAe,EAClB,MAAM,gBAAgB,CAAC;AAWxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EACH,gBAAgB,EAChB,iBAAiB,EAGpB,MAAM,oBAAoB,CAAC;AAG5B;;;;;;;;;;GAUG;AACH,KAAK,oBAAoB,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,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;YACW,gBAAgB;IAgE9B;;OAEG;IACH,OAAO,CAAC,YAAY;IAyBpB;;;;;;;;;;;;;OAaG;cACa,mBAAmB,CAC/B,OAAO,EAAE,gBAAgB,EAAE,EAC3B,WAAW,EAAE,QAAQ,GACtB,OAAO,CAAC,gBAAgB,EAAE,CAAC;IA6B9B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAa5B;;;;OAIG;YACW,mBAAmB;IA8DjC;;;;;;;;OAQG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,6BAA6B,CACH;IAElD;;;;;OAKG;YACW,4BAA4B;IA8C1C,kCAAkC;IAClC;;;;;;OAMG;IACU,kBAAkB,CAAC,KAAK,EAAE;QACnC,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,aAAa,EAAE,MAAM,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,QAAQ,CAAC;QACtB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACxC,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBjB;;;;;;;;;OASG;YACW,kBAAkB;IAiEhC,OAAO,CAAC,gBAAgB;IAYxB,kEAAkE;IAClE,OAAO,CAAC,qBAAqB;IAW7B,6EAA6E;IAC7E,OAAO,CAAC,SAAS;CAUpB"}
|
|
@@ -1549,12 +1549,32 @@ export class SearchEngine extends BaseSingleton {
|
|
|
1549
1549
|
// Check row filters — role RLS AND API-key filters (GetEffectiveRowFilterWhereClause)
|
|
1550
1550
|
const rlsClause = entity.GetEffectiveRowFilterWhereClause(contextUser, EntityPermissionType.Read, '');
|
|
1551
1551
|
if (!rlsClause) {
|
|
1552
|
-
// No
|
|
1553
|
-
|
|
1552
|
+
// No row filter, or the user is exempt from row filtering. That settles WHICH ROWS of
|
|
1553
|
+
// this entity they may see — it does not establish that these results ARE this
|
|
1554
|
+
// entity's rows. `EntityName` is provider output, and for the vector and 3rd-party
|
|
1555
|
+
// lanes it comes from the index: vector metadata's `Entity` key, or the index name.
|
|
1556
|
+
// Admitting on that label alone lets whoever writes the index choose which entity's
|
|
1557
|
+
// permissions get evaluated, so a label naming an entity the user CAN read admits
|
|
1558
|
+
// documents that are not that entity's records at all.
|
|
1559
|
+
//
|
|
1560
|
+
// Results from a lane that queried the entity directly need no such check — their ids
|
|
1561
|
+
// came out of a RunView against it. So pass those through untouched (this is the hot
|
|
1562
|
+
// path and its cost is unchanged) and verify only the rest.
|
|
1563
|
+
const selfEvident = [];
|
|
1564
|
+
const unverified = [];
|
|
1565
|
+
for (const item of entityResults) {
|
|
1566
|
+
(SearchEngine.LanesWithSelfEvidentOwnership.has(item.SourceType) ? selfEvident : unverified)
|
|
1567
|
+
.push(item);
|
|
1568
|
+
}
|
|
1569
|
+
permitted.push(...selfEvident);
|
|
1570
|
+
if (unverified.length > 0) {
|
|
1571
|
+
await this.verifyOwnershipAndRowFilters(entity, unverified, undefined, contextUser, permitted);
|
|
1572
|
+
}
|
|
1554
1573
|
return;
|
|
1555
1574
|
}
|
|
1556
|
-
//
|
|
1557
|
-
|
|
1575
|
+
// A row filter applies — validate record IDs via RunView. Unchanged: this path already
|
|
1576
|
+
// verified ownership as a side effect of filtering, for every lane.
|
|
1577
|
+
await this.verifyOwnershipAndRowFilters(entity, entityResults, rlsClause, contextUser, permitted);
|
|
1558
1578
|
}
|
|
1559
1579
|
catch (error) {
|
|
1560
1580
|
// Fail closed — if anything goes wrong, exclude the results
|
|
@@ -1563,19 +1583,34 @@ export class SearchEngine extends BaseSingleton {
|
|
|
1563
1583
|
}
|
|
1564
1584
|
}
|
|
1565
1585
|
/**
|
|
1566
|
-
*
|
|
1567
|
-
*
|
|
1586
|
+
* Lanes whose results are self-evidently records of the entity they are labelled with, because the
|
|
1587
|
+
* provider obtained them by querying that entity through `RunView`. Everything else — the vector
|
|
1588
|
+
* lane, and any 3rd-party provider keyed by its own `SourceType` — carries a label supplied by
|
|
1589
|
+
* whatever populated the index, and must be verified before its permissions are trusted.
|
|
1590
|
+
*
|
|
1591
|
+
* An allowlist rather than a denylist on purpose: a `SourceType` nobody anticipated is verified by
|
|
1592
|
+
* default instead of trusted by default.
|
|
1593
|
+
*/
|
|
1594
|
+
static { this.LanesWithSelfEvidentOwnership = new Set(['entity', 'fulltext']); }
|
|
1595
|
+
/**
|
|
1596
|
+
* Use RunView to confirm the results really are records of `entity`, and — when a row filter is
|
|
1597
|
+
* supplied — that the user may see them.
|
|
1598
|
+
* Only results whose record IDs come back are added to `permitted`, so a result whose id is not a
|
|
1599
|
+
* record of this entity is dropped whether or not a row filter exists.
|
|
1568
1600
|
*/
|
|
1569
|
-
async
|
|
1601
|
+
async verifyOwnershipAndRowFilters(entity, entityResults, rlsClause, contextUser, permitted) {
|
|
1570
1602
|
const pkField = entity.FirstPrimaryKey;
|
|
1571
1603
|
if (!pkField) {
|
|
1572
1604
|
// Cannot verify without a primary key — exclude results
|
|
1573
|
-
LogError(`SearchEngine: Entity "${entity.Name}" has no primary key, cannot
|
|
1605
|
+
LogError(`SearchEngine: Entity "${entity.Name}" has no primary key, cannot verify result ownership`);
|
|
1574
1606
|
return;
|
|
1575
1607
|
}
|
|
1576
1608
|
const pkFieldName = pkField.Name;
|
|
1577
1609
|
const recordIDs = entityResults.map(r => `'${r.RecordID.replace(/'/g, "''")}'`).join(',');
|
|
1578
|
-
|
|
1610
|
+
// Without a row filter this is a pure existence check against the entity's own view.
|
|
1611
|
+
const filter = rlsClause
|
|
1612
|
+
? `${pkFieldName} IN (${recordIDs}) AND (${rlsClause})`
|
|
1613
|
+
: `${pkFieldName} IN (${recordIDs})`;
|
|
1579
1614
|
const rv = new RunView();
|
|
1580
1615
|
const result = await rv.RunView({
|
|
1581
1616
|
EntityName: entity.Name,
|
|
@@ -1585,7 +1620,7 @@ export class SearchEngine extends BaseSingleton {
|
|
|
1585
1620
|
}, contextUser);
|
|
1586
1621
|
if (!result.Success) {
|
|
1587
1622
|
// RunView failed — fail closed, exclude all results
|
|
1588
|
-
LogError(`SearchEngine: RLS RunView failed for entity "${entity.Name}": ${result.ErrorMessage ?? 'unknown error'}`);
|
|
1623
|
+
LogError(`SearchEngine: ownership/RLS RunView failed for entity "${entity.Name}": ${result.ErrorMessage ?? 'unknown error'}`);
|
|
1589
1624
|
return;
|
|
1590
1625
|
}
|
|
1591
1626
|
const validIDs = new Set(result.Results.map(r => NormalizeUUID(String(r[pkFieldName]))));
|