@indxsearch/indx-types 3.1.0 → 4.0.0-beta.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/CHANGELOG.md +54 -0
- package/README.md +13 -20
- package/dist/boost.d.ts +7 -2
- package/dist/cold.d.ts +62 -0
- package/dist/enums.d.ts +46 -12
- package/dist/enums.js +55 -14
- package/dist/errors.d.ts +8 -7
- package/dist/errors.js +8 -7
- package/dist/fields.d.ts +22 -5
- package/dist/filters.d.ts +47 -2
- package/dist/index.d.ts +17 -15
- package/dist/index.js +4 -2
- package/dist/problem.d.ts +10 -3
- package/dist/query.d.ts +85 -23
- package/dist/result.d.ts +111 -4
- package/dist/result.js +2 -1
- package/dist/rules.d.ts +83 -0
- package/dist/rules.js +1 -0
- package/dist/status.d.ts +9 -4
- package/dist/synonyms.d.ts +1 -1
- package/dist/vector.d.ts +1 -1
- package/package.json +1 -1
- package/dist/access.d.ts +0 -19
- /package/dist/{access.js → cold.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,59 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.0.0-beta.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Loads in plain Node, Vitest and anything else that resolves by the ESM rules: the build now imports its own files with their extensions, so the enums (`SearchMode`, `Tolerance`, `SystemState` …) work at runtime, not only under a bundler. And the rest of the 6.0 server's search is typed: `offset`, `facetFields`, `facetValueLimit` and `includeDocuments` on `QueryProxy`; `documents` (typed with a generic, `Result<Book>`), `facetStats` and `cold` on `Result`; `MultiSearchAnswer` for `search/multi`; and cold storage's `ColdWrite`, `ColdBatchItem`, `ColdBatchOutcome` and `ColdView`.
|
|
8
|
+
|
|
9
|
+
## 4.0.0-beta.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- 0b3925e: `filters/combine` takes a list. `CombinedFilterProxy` is `{ filters: FilterProxy[], useAndOperation }`
|
|
14
|
+
in place of `{ a, b, useAndOperation }`, and the server makes one filter of the whole list. The
|
|
15
|
+
intrface sends one combine per field and one for the whole selection, where it sent one per pair:
|
|
16
|
+
three values on one field were two requests and are one. Needs a server with the list form.
|
|
17
|
+
- a394c82: The 6.0 wire: a query in three parts. `QueryProxy` takes `mode` (`SearchMode`: `EditDistance`,
|
|
18
|
+
the default, or `Bm25f`; whether the records are reranked by Coverage is `ranking.rerank`, on by
|
|
19
|
+
default) and three parts, `match` (`MatchSetup`: tolerance, rungs, the word being
|
|
20
|
+
typed), `candidates` (`CandidateSetup`: `candidatesPerRow`, `maxCandidates`, `fallback`, `rest`) and
|
|
21
|
+
`ranking` (`RankingProxy`: the blend, field weights and boosts, `boosts` and `buries`).
|
|
22
|
+
`enableCoverage`, `coverageDepth`, `coverageSetup` and the `CoverageSetup` and `CloudQuery` types are
|
|
23
|
+
gone. Enums are strings, by name, as the server now sends and reads them (`BoostStrength.Med`, was
|
|
24
|
+
`Medium`). `Result` loses `truncationIndex` and `truncationScore` and has `toleranceCounts`,
|
|
25
|
+
`countedTolerance`, `count`, `ranked`, `isFallback`, `reason` and `systemState` (`toleranceCounts.rest`
|
|
26
|
+
with `candidates.rest`). The provider's `countedTotal` is the result's `count`. `FieldProxy` follows the
|
|
27
|
+
server's: `wordMatching` in place of `searchable`, and `tolerance` (`Exact`, `OneEdit`,
|
|
28
|
+
`TwoEdits`) in place of `coverageStrictness`, whose `None` is a `rerankWeight` of 0; the
|
|
29
|
+
`CoverageStrictness` enum is gone. Coverage is called reranking: `enableMatchReport`,
|
|
30
|
+
`matchReport` (`MatchReport`) and a field's `rerankWeight` in place of `enableCoverageReport`,
|
|
31
|
+
`coverageReport` and `coverageWeight`.
|
|
32
|
+
|
|
33
|
+
The settings panel shows the mode and a rerank switch. The intrface provider takes `mode`, `match`, `candidates` and `ranking` in place of
|
|
34
|
+
`enableCoverage`, `coverageDepth` (now `candidates.maxCandidates`) and `initialCoverageSetup`;
|
|
35
|
+
`SearchSettings` holds the same, and `setSearchSettings` merges a part member by member. The state's
|
|
36
|
+
`truncationIndex` is `countedTotal`, the records the search counted, with `isFallback` beside it.
|
|
37
|
+
Needs a 6.0 server.
|
|
38
|
+
|
|
39
|
+
- 496a2dc: The rest of the 6.0 server's requests and answers: `InFilterProxy`, `PositionFilterProxy`,
|
|
40
|
+
`FilterExpressionProxy` with `FilterExpressionResultProxy` and `FilterExpressionErrorDetail`, the
|
|
41
|
+
saved `BoostRule` and `BuryRule` (`RuleCondition`), a dataset's `DatasetQueryParameters` and
|
|
42
|
+
`QueryParametersResponse`, and field profiles (`FieldProfile`, `FieldProfileView`,
|
|
43
|
+
`FieldProfilesResponse`, `FieldProfilesRequest`). `FieldProxy.typingPrefixFrom` and
|
|
44
|
+
`ValueFilterProxy.isCaseSensitive` are added; `SystemStatus` has `indexedTextTruncated`,
|
|
45
|
+
`wordTokenSizeCapped` and `fieldK1Ignored`, and loses `tooLongClientText` and
|
|
46
|
+
`unknownConfigurationError`, which the server no longer sends. `IndxProblemCode` names every code
|
|
47
|
+
the server answers with, `invalidFilterExpression` among them, and `IndxProblem.errors` carries an
|
|
48
|
+
expression's errors. `PageFill`, `MatchReport`, `RecordMatch`, `QueryWordMatch` and `WordMatch` are
|
|
49
|
+
exported. Every type is checked against the server's OpenAPI document.
|
|
50
|
+
|
|
51
|
+
### Minor Changes
|
|
52
|
+
|
|
53
|
+
- 9085f78: `QueryProxy.measureFit` and `QueryFitResult`: a search can also say how well its results explain the
|
|
54
|
+
text (`explainedShare`, `unexplainedShare`, `explainedWords`, `unexplainedWords`), for telling a
|
|
55
|
+
search from a question.
|
|
56
|
+
|
|
3
57
|
## 3.1.0
|
|
4
58
|
|
|
5
59
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -60,8 +60,7 @@ const valueFilter: ValueFilterProxy = {
|
|
|
60
60
|
|
|
61
61
|
// Combined filter
|
|
62
62
|
const combinedFilter: CombinedFilterProxy = {
|
|
63
|
-
|
|
64
|
-
b: valueFilter,
|
|
63
|
+
filters: [rangeFilter, valueFilter],
|
|
65
64
|
useAndOperation: true
|
|
66
65
|
};
|
|
67
66
|
```
|
|
@@ -80,30 +79,22 @@ const boost: BoostProxy = {
|
|
|
80
79
|
|
|
81
80
|
const query: QueryProxy = {
|
|
82
81
|
text: 'search term',
|
|
83
|
-
|
|
84
|
-
boosts: [boost]
|
|
82
|
+
ranking: { boosts: [boost] }
|
|
85
83
|
};
|
|
86
84
|
```
|
|
87
85
|
|
|
88
|
-
###
|
|
86
|
+
### Match, Candidates and Ranking
|
|
89
87
|
|
|
90
88
|
```typescript
|
|
91
|
-
import
|
|
92
|
-
|
|
93
|
-
const coverageSetup: CoverageSetup = {
|
|
94
|
-
coverWholeQuery: true,
|
|
95
|
-
coverWholeWords: true,
|
|
96
|
-
coverFuzzyWords: true,
|
|
97
|
-
minWordSize: 2,
|
|
98
|
-
levenshteinMaxWordSize: 20,
|
|
99
|
-
truncate: true,
|
|
100
|
-
truncationScore: 255
|
|
101
|
-
};
|
|
89
|
+
import { SearchMode, Tolerance } from '@indxsearch/indx-types';
|
|
90
|
+
import type { QueryProxy } from '@indxsearch/indx-types';
|
|
102
91
|
|
|
103
92
|
const query: QueryProxy = {
|
|
104
93
|
text: 'search term',
|
|
105
|
-
|
|
106
|
-
|
|
94
|
+
mode: SearchMode.Coverage,
|
|
95
|
+
match: { tolerance: Tolerance.OneEdit }, // what counts as a hit
|
|
96
|
+
candidates: { maxCandidates: 200 }, // who comes in
|
|
97
|
+
ranking: { share: 0.2 } // the order
|
|
107
98
|
};
|
|
108
99
|
```
|
|
109
100
|
|
|
@@ -125,8 +116,10 @@ if (status.systemState === SystemState.Ready) {
|
|
|
125
116
|
### Types
|
|
126
117
|
|
|
127
118
|
#### Query Types
|
|
128
|
-
- `QueryProxy` - Main search query interface
|
|
129
|
-
- `
|
|
119
|
+
- `QueryProxy` - Main search query interface: `mode` and the parts below
|
|
120
|
+
- `MatchSetup` - What counts as a hit: tolerance, rungs, the word being typed
|
|
121
|
+
- `CandidateSetup` - Who comes in: candidates per row, the bound, the fallback
|
|
122
|
+
- `RankingProxy` - The order: the blend, field weights and boosts, boosts and buries
|
|
130
123
|
|
|
131
124
|
#### Filter Types
|
|
132
125
|
- `FilterProxy` - Base filter interface
|
package/dist/boost.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import { BoostStrength } from './enums';
|
|
2
|
-
import { FilterProxy } from './filters';
|
|
1
|
+
import { BoostStrength, BuryStrength } from './enums.js';
|
|
2
|
+
import { FilterProxy } from './filters.js';
|
|
3
3
|
export interface BoostProxy {
|
|
4
4
|
boostStrength: BoostStrength;
|
|
5
5
|
filterProxy: FilterProxy;
|
|
6
6
|
}
|
|
7
|
+
/** A bury, the counterpart of a boost: from `buries/from-filter`, sent in `ranking.buries`. */
|
|
8
|
+
export interface BuryProxy {
|
|
9
|
+
buryStrength: BuryStrength;
|
|
10
|
+
filterProxy: FilterProxy;
|
|
11
|
+
}
|
package/dist/cold.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Who may read a cold storage item. `public`: anyone who may read the dataset, a Search key in a
|
|
3
|
+
* browser included (but not a Search key over MCP, which reads none). `answer`: also Search or ask's
|
|
4
|
+
* answer, Read keys and Viewers, never a Search key. `private` (the default): only Full keys, Read
|
|
5
|
+
* keys with private cold storage allowed, and Editors and Admins in the console.
|
|
6
|
+
*/
|
|
7
|
+
export type ColdVisibility = 'public' | 'answer' | 'private';
|
|
8
|
+
/** The body of `PUT .../documents/{key}/cold/{name}` (`?language=` optional): one item beside a
|
|
9
|
+
* record, never searched, read when a question needs it. */
|
|
10
|
+
export interface ColdWrite {
|
|
11
|
+
content: string;
|
|
12
|
+
/** e.g. `text/markdown`, `application/json`; default `text/plain`. */
|
|
13
|
+
contentType?: string | null;
|
|
14
|
+
description?: string | null;
|
|
15
|
+
/** Default `private`. */
|
|
16
|
+
visibility?: ColdVisibility | null;
|
|
17
|
+
/** The sender's own reference to where the content came from. */
|
|
18
|
+
sourceRef?: string | null;
|
|
19
|
+
/** When the source last changed it (ISO 8601): a write older than what is stored is refused. */
|
|
20
|
+
sourceUpdatedUtc?: string | null;
|
|
21
|
+
}
|
|
22
|
+
/** One item of `PUT .../cold` (`?prune=true` also deletes what the same sender wrote before and
|
|
23
|
+
* did not send now). The record is named by its Indx key, or by `id`: the id the dataset's webhook
|
|
24
|
+
* gave it, or the key as text. */
|
|
25
|
+
export interface ColdBatchItem extends ColdWrite {
|
|
26
|
+
name: string;
|
|
27
|
+
recordKey?: number | null;
|
|
28
|
+
id?: string | null;
|
|
29
|
+
language?: string | null;
|
|
30
|
+
}
|
|
31
|
+
/** How one batch item went, in the place of the item. */
|
|
32
|
+
export interface ColdBatchOutcome {
|
|
33
|
+
/** 0 when no record has the item's id. */
|
|
34
|
+
recordKey: number;
|
|
35
|
+
name: string;
|
|
36
|
+
language: string;
|
|
37
|
+
outcome: 'created' | 'updated' | 'versionmismatch' | 'olderthanstored' | 'refused' | (string & {});
|
|
38
|
+
/** Why, when it was not written. */
|
|
39
|
+
detail?: string | null;
|
|
40
|
+
/** The item's `id`, as it gave it. */
|
|
41
|
+
id?: string | null;
|
|
42
|
+
}
|
|
43
|
+
/** An item as read: `GET .../documents/{key}/cold` lists them without content, `GET .../cold/{name}`
|
|
44
|
+
* returns one with it. */
|
|
45
|
+
export interface ColdView {
|
|
46
|
+
name: string;
|
|
47
|
+
language: string;
|
|
48
|
+
recordKey: number;
|
|
49
|
+
/** Null in a listing. */
|
|
50
|
+
content?: string | null;
|
|
51
|
+
length: number;
|
|
52
|
+
contentType: string;
|
|
53
|
+
description: string;
|
|
54
|
+
visibility: ColdVisibility;
|
|
55
|
+
writtenBy: string;
|
|
56
|
+
writtenVia: string;
|
|
57
|
+
sourceRef?: string | null;
|
|
58
|
+
sourceUpdatedUtc?: string | null;
|
|
59
|
+
version: number;
|
|
60
|
+
createdUtc: string;
|
|
61
|
+
updatedUtc: string;
|
|
62
|
+
}
|
package/dist/enums.d.ts
CHANGED
|
@@ -1,22 +1,56 @@
|
|
|
1
1
|
export declare enum SystemState {
|
|
2
|
-
Created =
|
|
3
|
-
Loading =
|
|
4
|
-
Loaded =
|
|
5
|
-
Indexing =
|
|
6
|
-
Ready =
|
|
7
|
-
Error =
|
|
2
|
+
Created = "Created",
|
|
3
|
+
Loading = "Loading",
|
|
4
|
+
Loaded = "Loaded",
|
|
5
|
+
Indexing = "Indexing",
|
|
6
|
+
Ready = "Ready",
|
|
7
|
+
Error = "Error"
|
|
8
8
|
}
|
|
9
9
|
export declare enum BoostStrength {
|
|
10
|
-
Low =
|
|
11
|
-
|
|
12
|
-
High =
|
|
10
|
+
Low = "Low",
|
|
11
|
+
Med = "Med",
|
|
12
|
+
High = "High"
|
|
13
|
+
}
|
|
14
|
+
/** The counterpart of {@link BoostStrength}: how far a bury lowers the documents its filter holds. */
|
|
15
|
+
export declare enum BuryStrength {
|
|
16
|
+
Low = "Low",
|
|
17
|
+
Med = "Med",
|
|
18
|
+
High = "High"
|
|
13
19
|
}
|
|
14
20
|
/**
|
|
15
21
|
* How a SynonymEntry expands. Multidirectional: every term in the entry triggers the whole
|
|
16
22
|
* group. OneWay: only `source` expands, into `terms` (acronyms).
|
|
17
|
-
* Numeric on the wire, like every enum in this API.
|
|
18
23
|
*/
|
|
19
24
|
export declare enum SynonymDirection {
|
|
20
|
-
Multidirectional =
|
|
21
|
-
OneWay =
|
|
25
|
+
Multidirectional = "Multidirectional",
|
|
26
|
+
OneWay = "OneWay"
|
|
27
|
+
}
|
|
28
|
+
/** How a search finds and orders its documents (QueryProxy.mode). */
|
|
29
|
+
/** How a search fetches its records (QueryProxy.mode); whether they are reranked is
|
|
30
|
+
* `ranking.rerank`. Until 2 Nov 2026 a third value, Coverage, was EditDistance reranked. */
|
|
31
|
+
export declare enum SearchMode {
|
|
32
|
+
/** BM25F: no word lookup, no count. Reranked, its best up to the bound are reranked. */
|
|
33
|
+
Bm25f = "Bm25f",
|
|
34
|
+
/** The records holding every query word within the tolerance, ordered by rung. The default. */
|
|
35
|
+
EditDistance = "EditDistance"
|
|
36
|
+
}
|
|
37
|
+
/** The rungs a query word is met on: as typed, within one edit, within two, within three. */
|
|
38
|
+
export declare enum Tolerance {
|
|
39
|
+
Exact = "Exact",
|
|
40
|
+
OneEdit = "OneEdit",
|
|
41
|
+
TwoEdits = "TwoEdits",
|
|
42
|
+
ThreeEdits = "ThreeEdits"
|
|
43
|
+
}
|
|
44
|
+
/** Which rungs a search counts (MatchSetup.rungs). */
|
|
45
|
+
export declare enum Rungs {
|
|
46
|
+
/** The first rung that gives hits. The default. */
|
|
47
|
+
Fewest = "Fewest",
|
|
48
|
+
/** Every rung up to the tolerance, the nearer ranked first. */
|
|
49
|
+
All = "All"
|
|
50
|
+
}
|
|
51
|
+
/** Which of the index's terms BM25F scores with (CandidateSetup.indexTerms). */
|
|
52
|
+
export declare enum IndexTerms {
|
|
53
|
+
Both = "Both",
|
|
54
|
+
Words = "Words",
|
|
55
|
+
Patterns = "Patterns"
|
|
22
56
|
}
|
package/dist/enums.js
CHANGED
|
@@ -1,28 +1,69 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
1
|
+
// Every enum is written by name on the wire since 6.0 (the server's JsonStringEnumConverter); a
|
|
2
|
+
// number in a request is still read, but these types say the names.
|
|
3
|
+
// Hibernated was removed Sep 2026 together with the server's: hibernation is a position in the
|
|
4
|
+
// pipeline, not a state. A hibernated dataset reports Created with recordsOnDisk > 0 in its
|
|
3
5
|
// status; the library's Hibernate() lands in Loaded.
|
|
4
6
|
export var SystemState;
|
|
5
7
|
(function (SystemState) {
|
|
6
|
-
SystemState[
|
|
7
|
-
SystemState[
|
|
8
|
-
SystemState[
|
|
9
|
-
SystemState[
|
|
10
|
-
SystemState[
|
|
11
|
-
SystemState[
|
|
8
|
+
SystemState["Created"] = "Created";
|
|
9
|
+
SystemState["Loading"] = "Loading";
|
|
10
|
+
SystemState["Loaded"] = "Loaded";
|
|
11
|
+
SystemState["Indexing"] = "Indexing";
|
|
12
|
+
SystemState["Ready"] = "Ready";
|
|
13
|
+
SystemState["Error"] = "Error";
|
|
12
14
|
})(SystemState || (SystemState = {}));
|
|
13
15
|
export var BoostStrength;
|
|
14
16
|
(function (BoostStrength) {
|
|
15
|
-
BoostStrength[
|
|
16
|
-
BoostStrength[
|
|
17
|
-
BoostStrength[
|
|
17
|
+
BoostStrength["Low"] = "Low";
|
|
18
|
+
BoostStrength["Med"] = "Med";
|
|
19
|
+
BoostStrength["High"] = "High";
|
|
18
20
|
})(BoostStrength || (BoostStrength = {}));
|
|
21
|
+
/** The counterpart of {@link BoostStrength}: how far a bury lowers the documents its filter holds. */
|
|
22
|
+
export var BuryStrength;
|
|
23
|
+
(function (BuryStrength) {
|
|
24
|
+
BuryStrength["Low"] = "Low";
|
|
25
|
+
BuryStrength["Med"] = "Med";
|
|
26
|
+
BuryStrength["High"] = "High";
|
|
27
|
+
})(BuryStrength || (BuryStrength = {}));
|
|
19
28
|
/**
|
|
20
29
|
* How a SynonymEntry expands. Multidirectional: every term in the entry triggers the whole
|
|
21
30
|
* group. OneWay: only `source` expands, into `terms` (acronyms).
|
|
22
|
-
* Numeric on the wire, like every enum in this API.
|
|
23
31
|
*/
|
|
24
32
|
export var SynonymDirection;
|
|
25
33
|
(function (SynonymDirection) {
|
|
26
|
-
SynonymDirection[
|
|
27
|
-
SynonymDirection[
|
|
34
|
+
SynonymDirection["Multidirectional"] = "Multidirectional";
|
|
35
|
+
SynonymDirection["OneWay"] = "OneWay";
|
|
28
36
|
})(SynonymDirection || (SynonymDirection = {}));
|
|
37
|
+
/** How a search finds and orders its documents (QueryProxy.mode). */
|
|
38
|
+
/** How a search fetches its records (QueryProxy.mode); whether they are reranked is
|
|
39
|
+
* `ranking.rerank`. Until 2 Nov 2026 a third value, Coverage, was EditDistance reranked. */
|
|
40
|
+
export var SearchMode;
|
|
41
|
+
(function (SearchMode) {
|
|
42
|
+
/** BM25F: no word lookup, no count. Reranked, its best up to the bound are reranked. */
|
|
43
|
+
SearchMode["Bm25f"] = "Bm25f";
|
|
44
|
+
/** The records holding every query word within the tolerance, ordered by rung. The default. */
|
|
45
|
+
SearchMode["EditDistance"] = "EditDistance";
|
|
46
|
+
})(SearchMode || (SearchMode = {}));
|
|
47
|
+
/** The rungs a query word is met on: as typed, within one edit, within two, within three. */
|
|
48
|
+
export var Tolerance;
|
|
49
|
+
(function (Tolerance) {
|
|
50
|
+
Tolerance["Exact"] = "Exact";
|
|
51
|
+
Tolerance["OneEdit"] = "OneEdit";
|
|
52
|
+
Tolerance["TwoEdits"] = "TwoEdits";
|
|
53
|
+
Tolerance["ThreeEdits"] = "ThreeEdits";
|
|
54
|
+
})(Tolerance || (Tolerance = {}));
|
|
55
|
+
/** Which rungs a search counts (MatchSetup.rungs). */
|
|
56
|
+
export var Rungs;
|
|
57
|
+
(function (Rungs) {
|
|
58
|
+
/** The first rung that gives hits. The default. */
|
|
59
|
+
Rungs["Fewest"] = "Fewest";
|
|
60
|
+
/** Every rung up to the tolerance, the nearer ranked first. */
|
|
61
|
+
Rungs["All"] = "All";
|
|
62
|
+
})(Rungs || (Rungs = {}));
|
|
63
|
+
/** Which of the index's terms BM25F scores with (CandidateSetup.indexTerms). */
|
|
64
|
+
export var IndexTerms;
|
|
65
|
+
(function (IndexTerms) {
|
|
66
|
+
IndexTerms["Both"] = "Both";
|
|
67
|
+
IndexTerms["Words"] = "Words";
|
|
68
|
+
IndexTerms["Patterns"] = "Patterns";
|
|
69
|
+
})(IndexTerms || (IndexTerms = {}));
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
/** By name on the wire since 6.0. */
|
|
1
2
|
export declare enum JsonErrorType {
|
|
2
|
-
None =
|
|
3
|
-
ControlCharacters =
|
|
4
|
-
TrailingComma =
|
|
5
|
-
UnescapedQuotes =
|
|
6
|
-
UnescapedBackslash =
|
|
7
|
-
StructuralError =
|
|
8
|
-
UnknownError =
|
|
3
|
+
None = "None",
|
|
4
|
+
ControlCharacters = "ControlCharacters",
|
|
5
|
+
TrailingComma = "TrailingComma",
|
|
6
|
+
UnescapedQuotes = "UnescapedQuotes",
|
|
7
|
+
UnescapedBackslash = "UnescapedBackslash",
|
|
8
|
+
StructuralError = "StructuralError",
|
|
9
|
+
UnknownError = "UnknownError"
|
|
9
10
|
}
|
|
10
11
|
export interface ParseResult {
|
|
11
12
|
token?: string | null;
|
package/dist/errors.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
/** By name on the wire since 6.0. */
|
|
1
2
|
export var JsonErrorType;
|
|
2
3
|
(function (JsonErrorType) {
|
|
3
|
-
JsonErrorType[
|
|
4
|
-
JsonErrorType[
|
|
5
|
-
JsonErrorType[
|
|
6
|
-
JsonErrorType[
|
|
7
|
-
JsonErrorType[
|
|
8
|
-
JsonErrorType[
|
|
9
|
-
JsonErrorType[
|
|
4
|
+
JsonErrorType["None"] = "None";
|
|
5
|
+
JsonErrorType["ControlCharacters"] = "ControlCharacters";
|
|
6
|
+
JsonErrorType["TrailingComma"] = "TrailingComma";
|
|
7
|
+
JsonErrorType["UnescapedQuotes"] = "UnescapedQuotes";
|
|
8
|
+
JsonErrorType["UnescapedBackslash"] = "UnescapedBackslash";
|
|
9
|
+
JsonErrorType["StructuralError"] = "StructuralError";
|
|
10
|
+
JsonErrorType["UnknownError"] = "UnknownError";
|
|
10
11
|
})(JsonErrorType || (JsonErrorType = {}));
|
package/dist/fields.d.ts
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
|
+
import { Tolerance } from './enums.js';
|
|
1
2
|
export interface FieldProxy {
|
|
2
3
|
fieldName: string;
|
|
3
4
|
/** Read-only on GET; ignored on SET. */
|
|
4
5
|
fieldType?: string | null;
|
|
5
6
|
/** Read-only on GET; ignored on SET. */
|
|
6
7
|
isArray?: boolean | null;
|
|
7
|
-
|
|
8
|
+
/** Read-only on GET: some records lack the field. */
|
|
9
|
+
optional?: boolean | null;
|
|
10
|
+
/** Read-only on GET: a value of the field from the analysed records. */
|
|
11
|
+
sampleValue?: string | null;
|
|
12
|
+
/** Searched by its words, and in the word lookup. A field with neither this nor patternMatching is not searched. */
|
|
13
|
+
wordMatching?: boolean | null;
|
|
8
14
|
filterable?: boolean | null;
|
|
9
15
|
facetable?: boolean | null;
|
|
10
16
|
sortable?: boolean | null;
|
|
11
|
-
|
|
17
|
+
/** Matched inside its words (true) or by whole words only (false, the default). */
|
|
18
|
+
patternMatching?: boolean | null;
|
|
19
|
+
/** With pattern matching on: the index sizes, e.g. [3] or [2, 3]. */
|
|
20
|
+
indexSizes?: number[] | null;
|
|
21
|
+
numberOfStartCharacters?: number | null;
|
|
22
|
+
numberOfStopCharacters?: number | null;
|
|
12
23
|
embeddable?: boolean | null;
|
|
13
24
|
preloadFilters?: boolean | null;
|
|
14
25
|
/** Score weight multiplier (typical 1.0–3.0). Only meaningful when searchable. */
|
|
@@ -17,7 +28,13 @@ export interface FieldProxy {
|
|
|
17
28
|
bM25b?: number | null;
|
|
18
29
|
/** Per-field term-frequency saturation parameter k1. Typical 1.0–2.0. */
|
|
19
30
|
bM25k1?: number | null;
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
31
|
+
/** The most a word may differ by in the field: Exact, OneEdit (the default), TwoEdits, ThreeEdits; a search's match.tolerance caps it. */
|
|
32
|
+
tolerance?: Tolerance | null;
|
|
33
|
+
/** The field's weight in the reranker (ranking.rerank) against the heaviest field; 0 leaves it
|
|
34
|
+
* out of the reranker and the word lookup. */
|
|
35
|
+
rerankWeight?: number | null;
|
|
36
|
+
caseSensitive?: boolean | null;
|
|
37
|
+
/** From how many letters the word being typed matches the start of a longer word in this
|
|
38
|
+
* field; null takes the search's match.typingPrefixFrom. */
|
|
39
|
+
typingPrefixFrom?: number | null;
|
|
23
40
|
}
|
package/dist/filters.d.ts
CHANGED
|
@@ -9,10 +9,55 @@ export interface RangeFilterProxy {
|
|
|
9
9
|
export interface ValueFilterProxy {
|
|
10
10
|
fieldName: string;
|
|
11
11
|
value?: any | null;
|
|
12
|
+
/** Match the value's casing exactly; off by default, so "fire" also matches Fire and FIRE. */
|
|
13
|
+
isCaseSensitive?: boolean;
|
|
12
14
|
}
|
|
15
|
+
/** The body of POST filters/in: documents whose field holds one of the values, as one filter.
|
|
16
|
+
* Numbers compare as numbers on a numeric field. */
|
|
17
|
+
export interface InFilterProxy {
|
|
18
|
+
fieldName: string;
|
|
19
|
+
values: Array<string | number | boolean>;
|
|
20
|
+
isCaseSensitive?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** The body of POST filters/position: documents within `withinMeter` metres of a position. The
|
|
23
|
+
* field is an object `{ latitude, longitude }` whose two numbers are Filterable. */
|
|
24
|
+
export interface PositionFilterProxy {
|
|
25
|
+
fieldName: string;
|
|
26
|
+
latitude: number;
|
|
27
|
+
longitude: number;
|
|
28
|
+
withinMeter: number;
|
|
29
|
+
}
|
|
30
|
+
/** The body of POST filters/expression: `brand IN ["nike", "puma"] AND price BETWEEN 100 AND 2000`;
|
|
31
|
+
* `parameters` gives the filter token for each `$name` placeholder. */
|
|
32
|
+
export interface FilterExpressionProxy {
|
|
33
|
+
expression: string;
|
|
34
|
+
parameters?: {
|
|
35
|
+
[name: string]: FilterProxy;
|
|
36
|
+
} | null;
|
|
37
|
+
}
|
|
38
|
+
/** The answer of POST filters/expression: the filter's token, and the expression as the engine
|
|
39
|
+
* reads it (values case-folded as compared); null `canonical` when a placeholder has no expression. */
|
|
40
|
+
export interface FilterExpressionResultProxy {
|
|
41
|
+
hashString: string;
|
|
42
|
+
canonical?: string | null;
|
|
43
|
+
}
|
|
44
|
+
/** One error of an expression that makes no filter, in a 400 `invalidFilterExpression`'s `errors`. */
|
|
45
|
+
export interface FilterExpressionErrorDetail {
|
|
46
|
+
kind: 'syntax' | 'unknownField' | 'fieldNotFilterable' | 'typeMismatch' | 'invalidNumber' | 'emptyRange' | 'limitExceeded' | 'unknownParameter' | 'invalidValue' | 'notInitialized' | (string & {});
|
|
47
|
+
message: string;
|
|
48
|
+
/** Where in the expression, in characters. */
|
|
49
|
+
start: number;
|
|
50
|
+
length: number;
|
|
51
|
+
/** A correction, when one is likely (a field name close to the one typed). */
|
|
52
|
+
suggestion?: string | null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The body of POST filters/combine: two or more filters combined with AND or OR into one
|
|
56
|
+
* filter. One request for the whole list; the same set in any order gives the same token, and
|
|
57
|
+
* one filter gives its own.
|
|
58
|
+
*/
|
|
13
59
|
export interface CombinedFilterProxy {
|
|
14
|
-
|
|
15
|
-
b: FilterProxy;
|
|
60
|
+
filters: FilterProxy[];
|
|
16
61
|
useAndOperation: boolean;
|
|
17
62
|
}
|
|
18
63
|
export interface UpdateFieldProxy {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
export { SystemState, BoostStrength, SynonymDirection } from './enums';
|
|
2
|
-
export { JsonErrorType } from './errors';
|
|
3
|
-
export { LoginInfo, LoginResponse, ChangePasswordRequest } from './auth';
|
|
4
|
-
export { QueryProxy,
|
|
5
|
-
export { FilterProxy, RangeFilterProxy, ValueFilterProxy, CombinedFilterProxy, UpdateFieldProxy, FilterFieldUpdateProxy } from './filters';
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
1
|
+
export { SystemState, BoostStrength, BuryStrength, SynonymDirection, SearchMode, Tolerance, Rungs, IndexTerms } from './enums.js';
|
|
2
|
+
export { JsonErrorType } from './errors.js';
|
|
3
|
+
export { LoginInfo, LoginResponse, ChangePasswordRequest } from './auth.js';
|
|
4
|
+
export { QueryProxy, MatchSetup, CandidateSetup, RankingProxy } from './query.js';
|
|
5
|
+
export { FilterProxy, RangeFilterProxy, ValueFilterProxy, CombinedFilterProxy, InFilterProxy, PositionFilterProxy, FilterExpressionProxy, FilterExpressionResultProxy, FilterExpressionErrorDetail, UpdateFieldProxy, FilterFieldUpdateProxy } from './filters.js';
|
|
6
|
+
export { RuleCondition, BoostRule, BuryRule, DatasetQueryParameters, QueryParametersResponse, FieldProfile, FieldProfileView, FieldProfilesResponse, FieldProfilesRequest } from './rules.js';
|
|
7
|
+
export { BoostProxy, BuryProxy } from './boost.js';
|
|
8
|
+
export { SynonymList, SynonymEntry } from './synonyms.js';
|
|
9
|
+
export { VectorQueryProxy, HybridQueryProxy, EmbeddingResultEntry } from './vector.js';
|
|
10
|
+
export { Result, QueryFitResult, ScoreEntry, ToleranceCounts, PageFill, MatchReport, RecordMatch, QueryWordMatch, WordMatch, FacetStats, MultiSearchAnswer, MultiSearchFailure, MAX_SEARCHES_PER_MULTI } from './result.js';
|
|
11
|
+
export { ColdVisibility, ColdWrite, ColdBatchItem, ColdBatchOutcome, ColdView } from './cold.js';
|
|
12
|
+
export { SystemStatus, LicenseInfo } from './status.js';
|
|
13
|
+
export { ParseResult, ProcessError, ProcessErrorCount } from './errors.js';
|
|
14
|
+
export { IndxProblem, IndxProblemCode } from './problem.js';
|
|
15
|
+
export { FieldProxy } from './fields.js';
|
|
16
|
+
export { DataSetListDto } from './datasets.js';
|
|
17
|
+
export { StringInt32KeyValuePair, StringSingleValueTuple } from './common.js';
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
// Enums
|
|
2
|
-
export { SystemState, BoostStrength, SynonymDirection } from './enums';
|
|
3
|
-
export { JsonErrorType } from './errors';
|
|
2
|
+
export { SystemState, BoostStrength, BuryStrength, SynonymDirection, SearchMode, Tolerance, Rungs, IndexTerms } from './enums.js';
|
|
3
|
+
export { JsonErrorType } from './errors.js';
|
|
4
|
+
// Result
|
|
5
|
+
export { MAX_SEARCHES_PER_MULTI } from './result.js';
|
package/dist/problem.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FilterExpressionErrorDetail } from './filters.js';
|
|
1
2
|
/**
|
|
2
3
|
* Machine-readable error code carried by every Indx error response, as the `code`
|
|
3
4
|
* extension of an RFC 9457 problem document. Switch on this, not on the HTTP status: a 400 can
|
|
@@ -16,8 +17,11 @@
|
|
|
16
17
|
* operator enabled per-key limits; or too many calls from this address carried no bearer token
|
|
17
18
|
* that validates (missing, expired or invalid). Carries `retryAfterSeconds` and a `Retry-After`
|
|
18
19
|
* header; wait that long and retry.
|
|
20
|
+
* - `invalidFilterExpression` (400): a filter expression makes no filter; `errors` holds each
|
|
21
|
+
* error with its place. Fix the expression; never retry without it.
|
|
22
|
+
* - `insufficientKeyScope` (403): the API key's access level is below the call.
|
|
19
23
|
*/
|
|
20
|
-
export type IndxProblemCode = 'invalidArgument' | 'invalidDatasetName' | 'loadFailed' | 'operationFailed' | 'unknownFilter' | 'invalidCredentials' | 'emailNotConfirmed' | 'insufficientRole' | 'datasetNotFound' | 'documentNotFound' | 'teamNotFound' | 'invalidState' | 'shadowBusy' | 'rateLimited';
|
|
24
|
+
export type IndxProblemCode = 'invalidArgument' | 'invalidDatasetName' | 'loadFailed' | 'operationFailed' | 'unknownFilter' | 'invalidCredentials' | 'emailNotConfirmed' | 'insufficientRole' | 'datasetNotFound' | 'documentNotFound' | 'teamNotFound' | 'invalidState' | 'shadowBusy' | 'rateLimited' | 'invalidFilterExpression' | 'insufficientKeyScope' | 'userNotFound' | 'passwordChangeFailed' | 'statisticsDisabled' | 'searchOrAskDisabled' | 'searchOrAskUnavailable' | 'searchOrAskBudgetSpent' | 'webhookNotFound' | 'heldBatchNotFound' | 'datasetBusy' | 'badSignature' | 'internalError';
|
|
21
25
|
/**
|
|
22
26
|
* An Indx error response body (`application/problem+json`, RFC 9457) with the `code`
|
|
23
27
|
* extension every endpoint adds. 401 from the JWT middleware comes without a body.
|
|
@@ -43,6 +47,9 @@ export interface IndxProblem {
|
|
|
43
47
|
errorMessage?: string;
|
|
44
48
|
/** `rateLimited` only: seconds until the window opens again (also the `Retry-After` header). */
|
|
45
49
|
retryAfterSeconds?: number;
|
|
46
|
-
/** Registration / password endpoints: per-field validation messages
|
|
47
|
-
|
|
50
|
+
/** Registration / password endpoints: per-field validation messages; `invalidFilterExpression`:
|
|
51
|
+
* each error of the expression with its place. */
|
|
52
|
+
errors?: string[] | FilterExpressionErrorDetail[];
|
|
53
|
+
/** `invalidFilterExpression` only: the expression with a caret under the first error. */
|
|
54
|
+
pointer?: string;
|
|
48
55
|
}
|
package/dist/query.d.ts
CHANGED
|
@@ -1,35 +1,97 @@
|
|
|
1
|
-
import { FilterProxy } from './filters';
|
|
2
|
-
import { BoostProxy } from './boost';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { FilterProxy } from './filters.js';
|
|
2
|
+
import { BoostProxy, BuryProxy } from './boost.js';
|
|
3
|
+
import { IndexTerms, Rungs, SearchMode, Tolerance } from './enums.js';
|
|
4
|
+
/** What counts as a hit. Every member optional: a member left out is the server's default. */
|
|
5
|
+
export interface MatchSetup {
|
|
6
|
+
/** The most a word may differ by; caps each field's own (FieldProxy.tolerance). Default TwoEdits. */
|
|
7
|
+
tolerance?: Tolerance;
|
|
8
|
+
/** Fewest (the default): the first rung with hits. All: every rung up to the tolerance. */
|
|
9
|
+
rungs?: Rungs;
|
|
10
|
+
/** The shortest word given one edit (3), two (6) and three (9, where the tolerance is ThreeEdits); 0 is never. */
|
|
11
|
+
oneEditFrom?: number;
|
|
12
|
+
twoEditsFrom?: number;
|
|
13
|
+
threeEditsFrom?: number;
|
|
14
|
+
/** Where the cursor is in the text: the word it is in is the one being typed. Null: the last word. */
|
|
15
|
+
cursorAt?: number | null;
|
|
16
|
+
/** The word being typed also as the start of a longer word from this many letters (3), and within one edit from (6). */
|
|
17
|
+
typingPrefixFrom?: number;
|
|
18
|
+
typingPrefixOneEditFrom?: number;
|
|
19
|
+
/** Words written together or apart count as the word. Default true. */
|
|
20
|
+
joinedWords?: boolean;
|
|
16
21
|
}
|
|
22
|
+
/** Who comes in. */
|
|
23
|
+
export interface CandidateSetup {
|
|
24
|
+
/** The candidates per row asked for (4): the bound is the rows times this, at most 5 000. */
|
|
25
|
+
candidatesPerRow?: number;
|
|
26
|
+
/** The bound itself, when set. */
|
|
27
|
+
maxCandidates?: number | null;
|
|
28
|
+
/** Which terms BM25F scores with. Default Both. */
|
|
29
|
+
indexTerms?: IndexTerms;
|
|
30
|
+
/** When no record holds every word: the most words, then pattern matches (isFallback). Default true. */
|
|
31
|
+
fallback?: boolean;
|
|
32
|
+
/** In EditDistance, BM25F's best not counted below the counted set, counted (toleranceCounts.rest)
|
|
33
|
+
* and in the facets. Default false. */
|
|
34
|
+
rest?: boolean;
|
|
35
|
+
/** A page short of the rows filled, below the counted and not counted, with the records holding
|
|
36
|
+
* the most of the words (result.fill.mostWords). Default false. */
|
|
37
|
+
fillWithMostWords?: boolean;
|
|
38
|
+
/** How many typo levels past the counted one fill a short page, below it and not counted: 0 no
|
|
39
|
+
* fill (default), 1 the next level, 2 up to two typos. */
|
|
40
|
+
fillReach?: number;
|
|
41
|
+
}
|
|
42
|
+
/** The order inside the rungs, with the boosts and buries as the tokens their endpoints give. */
|
|
43
|
+
export interface RankingProxy {
|
|
44
|
+
/** Whether the reranker orders the candidates by how their words were met, in either mode. Default true. */
|
|
45
|
+
rerank?: boolean;
|
|
46
|
+
/** The reranker's share of the score, 0 to 1. Default 0.2. */
|
|
47
|
+
share?: number;
|
|
48
|
+
/** How far the share moves towards the reranker while the last word is typed. Default 0.5. */
|
|
49
|
+
typingShift?: number;
|
|
50
|
+
longFieldFrom?: number;
|
|
51
|
+
longFieldWeightFloor?: number;
|
|
52
|
+
/** The whole query in a field floors the score. Default true. */
|
|
53
|
+
wholeQueryFloor?: boolean;
|
|
54
|
+
/** Per field, its reranker weight in this search. */
|
|
55
|
+
fieldWeights?: Record<string, number> | null;
|
|
56
|
+
/** Per field, a boost inside BM25F's saturation. */
|
|
57
|
+
fieldBoosts?: Record<string, number> | null;
|
|
58
|
+
/** A list that is not empty is on; the dataset's boost rules apply to every search beside them. */
|
|
59
|
+
boosts?: BoostProxy[] | null;
|
|
60
|
+
buries?: BuryProxy[] | null;
|
|
61
|
+
}
|
|
62
|
+
/** A search, as `POST .../search` takes it (6.0). */
|
|
17
63
|
export interface QueryProxy {
|
|
18
64
|
text?: string | null;
|
|
19
65
|
maxNumberOfRecordsToReturn?: number;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
66
|
+
/** How many ranked records to pass over before the first returned: page while `offset` is below
|
|
67
|
+
* the result's `ranked`. Default 0. */
|
|
68
|
+
offset?: number;
|
|
69
|
+
/** EditDistance or Bm25f. Left out: the dataset's mode, else EditDistance. */
|
|
70
|
+
mode?: SearchMode;
|
|
71
|
+
/** Null or left out: the defaults. */
|
|
72
|
+
match?: MatchSetup | null;
|
|
73
|
+
candidates?: CandidateSetup | null;
|
|
74
|
+
ranking?: RankingProxy | null;
|
|
75
|
+
/** Return `matchReport`, in any mode: how each query word was met in each record. */
|
|
76
|
+
enableMatchReport?: boolean;
|
|
23
77
|
enableFacets?: boolean;
|
|
24
|
-
|
|
78
|
+
/** The facetable fields to count; empty or left out counts every one. */
|
|
79
|
+
facetFields?: string[] | null;
|
|
80
|
+
/** The most values per facet field, the commonest first; 0 or left out returns them all.
|
|
81
|
+
* `facetStats` is of every value counted either way. */
|
|
82
|
+
facetValueLimit?: number;
|
|
83
|
+
/** The records' JSON comes with the result, in `documents`, in the order of `records`: one call
|
|
84
|
+
* instead of a search and a lookup. Default false. */
|
|
85
|
+
includeDocuments?: boolean;
|
|
25
86
|
removeDuplicates?: boolean;
|
|
26
87
|
sortAscending?: boolean;
|
|
27
88
|
sortBy?: string | null;
|
|
28
89
|
timeOutLimitMilliseconds?: number;
|
|
29
90
|
filter?: FilterProxy | null;
|
|
30
|
-
|
|
31
|
-
|
|
91
|
+
/** A filter expression, ANDed with `filter` when both are given. */
|
|
92
|
+
filterExpression?: string | null;
|
|
93
|
+
filterParameters?: Record<string, FilterProxy> | null;
|
|
32
94
|
logPrefix?: string | null;
|
|
95
|
+
/** The result then also says how well it explains the text: a {@link QueryFitResult}. */
|
|
96
|
+
measureFit?: boolean;
|
|
33
97
|
}
|
|
34
|
-
/** @deprecated Renamed to {@link QueryProxy} in 2.3.0 (the server dropped its "cloud" vocabulary); removed in 3.0. */
|
|
35
|
-
export type CloudQuery = QueryProxy;
|
package/dist/result.d.ts
CHANGED
|
@@ -1,14 +1,121 @@
|
|
|
1
|
-
import { StringInt32KeyValuePair } from './common';
|
|
1
|
+
import { StringInt32KeyValuePair } from './common.js';
|
|
2
|
+
import { SystemState, Tolerance } from './enums.js';
|
|
3
|
+
import { ProcessError } from './errors.js';
|
|
4
|
+
import { IndxProblem } from './problem.js';
|
|
2
5
|
export interface ScoreEntry {
|
|
3
6
|
documentKey: number;
|
|
4
7
|
score: number;
|
|
5
8
|
}
|
|
6
|
-
|
|
9
|
+
/** How a query word was met in a record. */
|
|
10
|
+
export type WordMatch = 'NotFound' | 'Whole' | 'Prefix' | 'Suffix' | 'Joined' | 'RunTogether' | 'OneEdit' | 'TwoEdits' | 'ThreeEdits' | 'Synonym' | number;
|
|
11
|
+
export interface QueryWordMatch {
|
|
12
|
+
word: string;
|
|
13
|
+
/** The field that confirmed the word; null when none did. */
|
|
14
|
+
field?: string | null;
|
|
15
|
+
how: WordMatch;
|
|
16
|
+
}
|
|
17
|
+
export interface RecordMatch {
|
|
18
|
+
documentKey: number;
|
|
19
|
+
/** The query's words, in its order. */
|
|
20
|
+
words: QueryWordMatch[];
|
|
21
|
+
}
|
|
22
|
+
/** How each query word was met in the returned records (query.enableMatchReport). */
|
|
23
|
+
export interface MatchReport {
|
|
24
|
+
/** Per record, in the order of `records`. */
|
|
25
|
+
matches?: RecordMatch[] | null;
|
|
26
|
+
/** Per field: how many query words were met each way, over the returned records. */
|
|
27
|
+
matchesByField?: {
|
|
28
|
+
[field: string]: {
|
|
29
|
+
[how: string]: number;
|
|
30
|
+
};
|
|
31
|
+
} | null;
|
|
32
|
+
}
|
|
33
|
+
/** How many listed records fill a short page, and from where (result.fill). */
|
|
34
|
+
export interface PageFill {
|
|
35
|
+
nextRungs: number;
|
|
36
|
+
mostWords: number;
|
|
37
|
+
}
|
|
38
|
+
/** How many records hold every query word on each rung, each with those before it; a rung not
|
|
39
|
+
* worked out is null. */
|
|
40
|
+
export interface ToleranceCounts {
|
|
41
|
+
exact: number;
|
|
42
|
+
oneEdit?: number | null;
|
|
43
|
+
twoEdits?: number | null;
|
|
44
|
+
threeEdits?: number | null;
|
|
45
|
+
/** With candidates.rest: the counted rung and the rest taken below it, up to the bound. */
|
|
46
|
+
rest?: number | null;
|
|
47
|
+
/** Of the counted, those holding a run of words only through a synonym; null when none fired. */
|
|
48
|
+
throughSynonym?: number | null;
|
|
49
|
+
}
|
|
50
|
+
/** A number field's values in the set the facets are counted over (result.facetStats): the lowest,
|
|
51
|
+
* the highest, and how many records hold one; `count` is null for an array field, whose records can
|
|
52
|
+
* hold several values. */
|
|
53
|
+
export interface FacetStats {
|
|
54
|
+
min: number;
|
|
55
|
+
max: number;
|
|
56
|
+
count?: number | null;
|
|
57
|
+
}
|
|
58
|
+
export interface Result<TDocument = Record<string, unknown>> {
|
|
7
59
|
records?: ScoreEntry[] | null;
|
|
8
60
|
facets?: {
|
|
9
61
|
[key: string]: StringInt32KeyValuePair[];
|
|
10
62
|
} | null;
|
|
63
|
+
/** Per number field among the facets: its lowest and highest value and how many records hold one. */
|
|
64
|
+
facetStats?: {
|
|
65
|
+
[field: string]: FacetStats;
|
|
66
|
+
} | null;
|
|
67
|
+
/** With query.includeDocuments: each record's JSON, as an object, in the order of `records`;
|
|
68
|
+
* null for a record deleted since. Type it with a generic when the shape is known:
|
|
69
|
+
* `Result<Book>`. */
|
|
70
|
+
documents?: Array<TDocument | null> | null;
|
|
71
|
+
/** The names of the cold storage each listed record holds, by record key, where any does and the
|
|
72
|
+
* caller's key may read it. Absent when none does. */
|
|
73
|
+
cold?: {
|
|
74
|
+
[documentKey: string]: string[];
|
|
75
|
+
} | null;
|
|
11
76
|
didTimeOut: boolean;
|
|
12
|
-
|
|
13
|
-
|
|
77
|
+
/** Set when the search was refused rather than finding nothing. */
|
|
78
|
+
reason?: ProcessError | null;
|
|
79
|
+
systemState?: SystemState;
|
|
80
|
+
/** The count; null in Bm25f mode. Until 6.0 the result carried truncationIndex and truncationScore. */
|
|
81
|
+
toleranceCounts?: ToleranceCounts | null;
|
|
82
|
+
/** The rung the list was taken from; null when nothing was counted. */
|
|
83
|
+
countedTolerance?: Tolerance | null;
|
|
84
|
+
/** How many records answer, in every mode: the rung counted (with the rest), the fallback's most
|
|
85
|
+
* words, every record BM25F scored, or every record the filter lets through in an empty search.
|
|
86
|
+
* count > ranked: an overflow at the depth. Until 2 Nov 2026 `overflow`. */
|
|
87
|
+
count?: number;
|
|
88
|
+
/** How many were ranked, at most the candidate bound. ranked > records.length: an overflow at the rows. */
|
|
89
|
+
ranked?: number;
|
|
90
|
+
/** Nothing was counted: the records holding the most of the words, then pattern matches. */
|
|
91
|
+
isFallback?: boolean;
|
|
92
|
+
/** Null unless the query asked for it. */
|
|
93
|
+
matchReport?: MatchReport | null;
|
|
94
|
+
/** Whether the reranker ordered the list (ranking.rerank as the search ran it). */
|
|
95
|
+
reranked?: boolean;
|
|
96
|
+
/** How many listed records fill a short page, not counted: from the next typo levels (every
|
|
97
|
+
* word), then holding the most of the words. In that order after the counted records. Null
|
|
98
|
+
* without the word lookup (Bm25f mode). */
|
|
99
|
+
fill?: PageFill | null;
|
|
100
|
+
}
|
|
101
|
+
/** A {@link Result} of a search with `measureFit`: how well the results explain the text. */
|
|
102
|
+
export interface QueryFitResult<TDocument = Record<string, unknown>> extends Result<TDocument> {
|
|
103
|
+
/** Share of the query's weight (its words' IDF) the best explaining result explains, 0 to 1. */
|
|
104
|
+
explainedShare: number;
|
|
105
|
+
/** Share carried by informative words no result explains, 0 to 1. */
|
|
106
|
+
unexplainedShare: number;
|
|
107
|
+
explainedWords: string[];
|
|
108
|
+
unexplainedWords: string[];
|
|
109
|
+
}
|
|
110
|
+
/** One answer of `POST .../search/multi`, in the place of its search: a {@link Result} with the
|
|
111
|
+
* `queryId` a single search sends as the `Indx-Query-Id` header, or the failure of that search
|
|
112
|
+
* alone, with the status and problem a single search would have had. */
|
|
113
|
+
export type MultiSearchAnswer<TDocument = Record<string, unknown>> = (Result<TDocument> & {
|
|
114
|
+
queryId?: string | null;
|
|
115
|
+
}) | MultiSearchFailure;
|
|
116
|
+
export interface MultiSearchFailure {
|
|
117
|
+
status: number;
|
|
118
|
+
error: IndxProblem;
|
|
14
119
|
}
|
|
120
|
+
/** The most searches one `search/multi` call takes. */
|
|
121
|
+
export declare const MAX_SEARCHES_PER_MULTI = 20;
|
package/dist/result.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
/** The most searches one `search/multi` call takes. */
|
|
2
|
+
export const MAX_SEARCHES_PER_MULTI = 20;
|
package/dist/rules.d.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { BoostStrength, BuryStrength, SearchMode } from './enums.js';
|
|
2
|
+
import { CandidateSetup, MatchSetup, RankingProxy } from './query.js';
|
|
3
|
+
import { Tolerance } from './enums.js';
|
|
4
|
+
/** A condition of a saved boost or bury rule: a value, or a range on a number field. */
|
|
5
|
+
export interface RuleCondition {
|
|
6
|
+
field?: string | null;
|
|
7
|
+
/** The value form; ignored when `min` or `max` is set. */
|
|
8
|
+
value?: string | null;
|
|
9
|
+
/** The range form, inclusive; null is open. */
|
|
10
|
+
min?: number | null;
|
|
11
|
+
max?: number | null;
|
|
12
|
+
/** Read only: whether this is the range form. */
|
|
13
|
+
readonly isRange?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** A saved boost rule (GET/PUT boosts), applied to every search of the dataset while it is
|
|
16
|
+
* enabled and inside its dates. */
|
|
17
|
+
export interface BoostRule {
|
|
18
|
+
name?: string | null;
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
conditions?: RuleCondition[] | null;
|
|
21
|
+
join: 'And' | 'Or';
|
|
22
|
+
strength: BoostStrength;
|
|
23
|
+
/** ISO dates; null is open. */
|
|
24
|
+
activeFrom?: string | null;
|
|
25
|
+
activeUntil?: string | null;
|
|
26
|
+
}
|
|
27
|
+
/** A saved bury rule (GET/PUT buries): the documents it holds are scored lower; nothing else moves. */
|
|
28
|
+
export interface BuryRule extends Omit<BoostRule, 'strength'> {
|
|
29
|
+
strength: BuryStrength;
|
|
30
|
+
}
|
|
31
|
+
/** A dataset's query parameters: what its searches take where they send none, member by member. */
|
|
32
|
+
export interface DatasetQueryParameters {
|
|
33
|
+
mode?: SearchMode | null;
|
|
34
|
+
match?: MatchSetup | null;
|
|
35
|
+
candidates?: CandidateSetup | null;
|
|
36
|
+
ranking?: RankingProxy | null;
|
|
37
|
+
}
|
|
38
|
+
/** GET query-parameters: what the dataset sets (null elsewhere), and what a search that sends
|
|
39
|
+
* none of these values runs with, every value filled in. */
|
|
40
|
+
export interface QueryParametersResponse {
|
|
41
|
+
parameters: DatasetQueryParameters;
|
|
42
|
+
effective: DatasetQueryParameters;
|
|
43
|
+
}
|
|
44
|
+
/** A field profile: a searched field's tolerance, rerank weight and pattern setup under one name. */
|
|
45
|
+
export interface FieldProfile {
|
|
46
|
+
id: string;
|
|
47
|
+
name: string;
|
|
48
|
+
about?: string | null;
|
|
49
|
+
builtIn?: boolean;
|
|
50
|
+
tolerance: Tolerance;
|
|
51
|
+
rerankWeight: number;
|
|
52
|
+
indexSizes: number[];
|
|
53
|
+
numberOfStartCharacters: number;
|
|
54
|
+
numberOfStopCharacters: number;
|
|
55
|
+
typingPrefixFrom?: number | null;
|
|
56
|
+
}
|
|
57
|
+
/** A profile as GET fields/profiles shows it: whether this dataset changed a built-in, and the
|
|
58
|
+
* fields that have it. */
|
|
59
|
+
export interface FieldProfileView extends FieldProfile {
|
|
60
|
+
edited: boolean;
|
|
61
|
+
fields: string[];
|
|
62
|
+
}
|
|
63
|
+
/** GET fields/profiles. */
|
|
64
|
+
export interface FieldProfilesResponse {
|
|
65
|
+
profiles: FieldProfileView[];
|
|
66
|
+
/** Field name to profile id. */
|
|
67
|
+
assignments: {
|
|
68
|
+
[field: string]: string;
|
|
69
|
+
};
|
|
70
|
+
/** Searched fields with settings of their own, no profile. */
|
|
71
|
+
custom: string[];
|
|
72
|
+
/** The profile a field gets when it becomes searched. */
|
|
73
|
+
defaultProfileId: string;
|
|
74
|
+
}
|
|
75
|
+
/** PUT fields/profiles. A part left out (null) is left as it is: `profiles` is the dataset's own
|
|
76
|
+
* list, whole; `assignments` gives fields a profile by id, or null for none. */
|
|
77
|
+
export interface FieldProfilesRequest {
|
|
78
|
+
profiles?: FieldProfile[] | null;
|
|
79
|
+
assignments?: {
|
|
80
|
+
[field: string]: string | null;
|
|
81
|
+
} | null;
|
|
82
|
+
defaultProfileId?: string | null;
|
|
83
|
+
}
|
package/dist/rules.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/status.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SystemState } from './enums';
|
|
2
|
-
import { ProcessErrorCount, ProcessError } from './errors';
|
|
1
|
+
import { SystemState } from './enums.js';
|
|
2
|
+
import { ProcessErrorCount, ProcessError } from './errors.js';
|
|
3
3
|
export interface LicenseInfo {
|
|
4
4
|
licensed: boolean;
|
|
5
5
|
validLicense: boolean;
|
|
@@ -21,9 +21,14 @@ export interface SystemStatus {
|
|
|
21
21
|
invalidDataSetName: boolean;
|
|
22
22
|
invalidState: boolean;
|
|
23
23
|
invalidArgument: boolean;
|
|
24
|
-
|
|
24
|
+
/** A query's text was over the length a search takes, and the search was refused. */
|
|
25
25
|
tooLongSearchText: boolean;
|
|
26
|
-
|
|
26
|
+
/** A record's text was cut at the length the index takes (the record is stored whole). */
|
|
27
|
+
indexedTextTruncated: boolean;
|
|
28
|
+
/** A word longer than the configuration takes was cut to it. */
|
|
29
|
+
wordTokenSizeCapped: boolean;
|
|
30
|
+
/** A field's own k1 is set on a BM25F dataset, where the dataset's k1 is used instead. */
|
|
31
|
+
fieldK1Ignored: boolean;
|
|
27
32
|
licenseInfo: LicenseInfo;
|
|
28
33
|
recoverableErrors?: ProcessErrorCount[] | null;
|
|
29
34
|
unrecoverableErrors?: ProcessError[] | null;
|
package/dist/synonyms.d.ts
CHANGED
package/dist/vector.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indxsearch/indx-types",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-beta.1",
|
|
4
4
|
"description": "TypeScript type definitions for Indx v2. Provides complete types for search queries, filters, boosts, results, and system status based on the official Swagger specification.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"indx",
|
package/dist/access.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export interface DataSetListDto {
|
|
2
|
-
name: string;
|
|
3
|
-
ownerUserId?: string | null;
|
|
4
|
-
/** "owner" | "editor" | "viewer" */
|
|
5
|
-
role: string;
|
|
6
|
-
}
|
|
7
|
-
export interface AccessGrantDto {
|
|
8
|
-
email: string;
|
|
9
|
-
/** "editor" | "viewer" */
|
|
10
|
-
role: string;
|
|
11
|
-
}
|
|
12
|
-
export interface GrantAccessRequest {
|
|
13
|
-
granteeEmail: string;
|
|
14
|
-
/** "editor" | "viewer" */
|
|
15
|
-
role: string;
|
|
16
|
-
}
|
|
17
|
-
export interface TransferOwnershipRequest {
|
|
18
|
-
newOwnerEmail: string;
|
|
19
|
-
}
|
|
File without changes
|