@indxsearch/indx-types 4.0.0-beta.1 → 4.0.0-beta.2

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.0-beta.2
4
+
5
+ ### Minor Changes
6
+
7
+ - Types for one search per keystroke: `GroupedSearchRequest`, `SearchGroup` and `GroupedSearchResult` for `search/groups` (one text answered in named sections, each with its own filter, rows and count), `MultiSearchQuery` for a `search/multi` search that says for itself whether it counts in the statistics, and `includeFields` on `QueryProxy` to get only the record fields a page shows. Also on `QueryProxy`: `collapseBy` (one record per value of a field, such as one row per title), `counts` (named counts in the same search, read from the result's `counts`), and `facetSelections` and `facetRanges` (facets that leave out their own selection, for OR within a facet group). `removeDuplicates` is gone: the server never acted on it.
8
+
3
9
  ## 4.0.0-beta.1
4
10
 
5
11
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  export { SystemState, BoostStrength, BuryStrength, SynonymDirection, SearchMode, Tolerance, Rungs, IndexTerms } from './enums.js';
2
2
  export { JsonErrorType } from './errors.js';
3
3
  export { LoginInfo, LoginResponse, ChangePasswordRequest } from './auth.js';
4
- export { QueryProxy, MatchSetup, CandidateSetup, RankingProxy } from './query.js';
4
+ export { QueryProxy, MatchSetup, CandidateSetup, RankingProxy, MultiSearchQuery, SearchGroup, GroupedSearchRequest } from './query.js';
5
5
  export { FilterProxy, RangeFilterProxy, ValueFilterProxy, CombinedFilterProxy, InFilterProxy, PositionFilterProxy, FilterExpressionProxy, FilterExpressionResultProxy, FilterExpressionErrorDetail, UpdateFieldProxy, FilterFieldUpdateProxy } from './filters.js';
6
6
  export { RuleCondition, BoostRule, BuryRule, DatasetQueryParameters, QueryParametersResponse, FieldProfile, FieldProfileView, FieldProfilesResponse, FieldProfilesRequest } from './rules.js';
7
7
  export { BoostProxy, BuryProxy } from './boost.js';
8
8
  export { SynonymList, SynonymEntry } from './synonyms.js';
9
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';
10
+ export { Result, QueryFitResult, ScoreEntry, ToleranceCounts, PageFill, MatchReport, RecordMatch, QueryWordMatch, WordMatch, FacetStats, MultiSearchAnswer, MultiSearchFailure, MAX_SEARCHES_PER_MULTI, GroupedSearchResult } from './result.js';
11
11
  export { ColdVisibility, ColdWrite, ColdBatchItem, ColdBatchOutcome, ColdView } from './cold.js';
12
12
  export { SystemStatus, LicenseInfo } from './status.js';
13
13
  export { ParseResult, ProcessError, ProcessErrorCount } from './errors.js';
package/dist/query.d.ts CHANGED
@@ -83,7 +83,23 @@ export interface QueryProxy {
83
83
  /** The records' JSON comes with the result, in `documents`, in the order of `records`: one call
84
84
  * instead of a search and a lookup. Default false. */
85
85
  includeDocuments?: boolean;
86
- removeDuplicates?: boolean;
86
+ /** With includeDocuments: only these top-level fields of each record. Null or empty: the whole record. */
87
+ includeFields?: string[] | null;
88
+ /** One record per value of these fields, in the ranking's order: the best-ranked kept, the next
89
+ * with a value not seen taking a duplicate's place; `offset` counts the records kept. Each field
90
+ * must have a role and not be an array. With includeFields, these fields must be among them. */
91
+ collapseBy?: string[] | null;
92
+ /** Named counts, each a filter expression: how many of the records `count` counts each lets
93
+ * through, in the result's `counts`. Counted over the same set as the facets, so no extra search;
94
+ * not the count a separate search with that filter would give where the typo levels differ. */
95
+ counts?: Record<string, string> | null;
96
+ /** The values ticked on facets, by Facetable field: the list holds records with one of a field's
97
+ * values (OR within a field, AND between fields and with the filter), and each selected field's
98
+ * facet is counted without its own selection. */
99
+ facetSelections?: Record<string, string[]> | null;
100
+ /** A range on a facet, by field: a filter expression on that field alone (`publishedYear >= 2010`),
101
+ * the field Facetable and Filterable. Its facet and facetStats are counted without it. */
102
+ facetRanges?: Record<string, string> | null;
87
103
  sortAscending?: boolean;
88
104
  sortBy?: string | null;
89
105
  timeOutLimitMilliseconds?: number;
@@ -95,3 +111,33 @@ export interface QueryProxy {
95
111
  /** The result then also says how well it explains the text: a {@link QueryFitResult}. */
96
112
  measureFit?: boolean;
97
113
  }
114
+ /** One search of `POST .../search/multi`: a search that may say for itself how it goes into the
115
+ * statistics, over the query string's `?count=`, `?source=` and `?session=`. */
116
+ export interface MultiSearchQuery extends QueryProxy {
117
+ /** Whether this search is a visitor's; left out: the query string's. */
118
+ count?: boolean | null;
119
+ source?: string | null;
120
+ session?: string | null;
121
+ }
122
+ /** One section of a {@link GroupedSearchRequest}. */
123
+ export interface SearchGroup {
124
+ /** The section's key in the answer's `groups`; unique in the request. */
125
+ name: string;
126
+ /** A filter expression for the section, ANDed with the search's own `filterExpression`. */
127
+ filter?: string | null;
128
+ /** How many records the section lists; 0 lists none and still counts. */
129
+ rows: number;
130
+ /** Count by this filter instead of `filter`: list the upcoming events, count them all. */
131
+ countFilter?: string | null;
132
+ /** The section's own candidates, ranking and match, each replacing the search's whole. */
133
+ candidates?: CandidateSetup | null;
134
+ ranking?: RankingProxy | null;
135
+ match?: MatchSetup | null;
136
+ /** The section that is the visitor's search, the one recorded in the statistics; none marked: the first. */
137
+ primary?: boolean;
138
+ }
139
+ /** The body of `POST .../search/groups`: one text answered in named sections. Everything but
140
+ * `groups` is every section's. At most 20 groups. */
141
+ export interface GroupedSearchRequest extends QueryProxy {
142
+ groups: SearchGroup[];
143
+ }
package/dist/result.d.ts CHANGED
@@ -60,6 +60,8 @@ export interface Result<TDocument = Record<string, unknown>> {
60
60
  facets?: {
61
61
  [key: string]: StringInt32KeyValuePair[];
62
62
  } | null;
63
+ /** For each name in query.counts, how many of the records `count` counts its filter lets through. */
64
+ counts?: Record<string, number> | null;
63
65
  /** Per number field among the facets: its lowest and highest value and how many records hold one. */
64
66
  facetStats?: {
65
67
  [field: string]: FacetStats;
@@ -119,3 +121,11 @@ export interface MultiSearchFailure {
119
121
  }
120
122
  /** The most searches one `search/multi` call takes. */
121
123
  export declare const MAX_SEARCHES_PER_MULTI = 20;
124
+ /** The answer of `POST .../search/groups`: each section's result by its name, a failed one as its
125
+ * failure, and the one `queryId` a click in any section refers to. */
126
+ export interface GroupedSearchResult<TDocument = Record<string, unknown>> {
127
+ groups: {
128
+ [name: string]: Result<TDocument> | MultiSearchFailure;
129
+ };
130
+ queryId?: string | null;
131
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indxsearch/indx-types",
3
- "version": "4.0.0-beta.1",
3
+ "version": "4.0.0-beta.2",
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",