@indxsearch/intrface 4.0.0-beta.4 → 4.0.0-beta.5

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.
@@ -0,0 +1,24 @@
1
+ import { default as React } from 'react';
2
+ export interface SearchPaginationProps {
3
+ /** Pages listed on each side of the current one. Default 1. */
4
+ siblings?: number;
5
+ size?: 'micro' | 'default';
6
+ /** Called after a page is chosen, e.g. to scroll the list back to its top. */
7
+ onPageChange?: (page: number) => void;
8
+ labels?: {
9
+ previous?: string;
10
+ next?: string;
11
+ page?: (page: number) => string;
12
+ /** The line under the pages when the count passes what can be paged. */
13
+ capped?: (pageable: number, total: number) => string;
14
+ };
15
+ className?: string;
16
+ }
17
+ /**
18
+ * Numbered pages for the list, as InstantSearch's pagination: each page is a search for its own
19
+ * records from where the pages before it end (Query.Offset), the count and the facets as they
20
+ * were. The page size is the provider's maxResults. A search ranks at most 5,000 records, so the
21
+ * pages stop there and say so. A new query, filter or sort goes back to the first page.
22
+ * (26 Nov 2026)
23
+ */
24
+ export declare const SearchPagination: React.FC<SearchPaginationProps>;
@@ -5,6 +5,9 @@ import { AskPicks } from '../hooks/useAsk';
5
5
  export interface SearchResultsProps {
6
6
  fields?: string[];
7
7
  resultsPerPage?: number;
8
+ /** The Load more button under the list. Default true; false where SearchPagination pages the
9
+ * list instead, so the two do not both offer the next records. */
10
+ loadMore?: boolean;
8
11
  /**
9
12
  * Convert string fields that hold a serialised list — JSON (`["a","b"]`) or
10
13
  * Python-style (`['a', 'b']`) — into a real string[] before they reach the
@@ -1,94 +1,9 @@
1
1
  import { default as React } from 'react';
2
- import { AskPicks } from '../hooks/useAsk';
3
- import { SearchMode, MatchSetup, CandidateSetup, RankingProxy, ToleranceCounts, PageFill, Tolerance } from '@indxsearch/indx-types';
2
+ import { SearchMode, MatchSetup, CandidateSetup, RankingProxy } from '@indxsearch/indx-types';
4
3
  import { SearchErrorInfo } from './searchError';
5
- import { ValueMatch, NumericRange } from './buildFilterProxy';
6
- export type { ValueMatch, NumericRange };
7
- /**
8
- * What every search from this provider is asked with: the query's mode and its three parts, as
9
- * the server takes them (6.0). The mode, or a member of a part, left out is the dataset's on the
10
- * server (its query parameters), else the engine default, so a page sets only what it means to
11
- * decide itself: every value it sends wins over the dataset's.
12
- */
13
- export interface SearchSettings {
14
- maxNumberOfRecordsToReturn: number;
15
- /** Left out: the dataset's mode, else EditDistance. */
16
- mode?: SearchMode;
17
- /** What counts as a hit: tolerance, rungs, the word being typed. */
18
- match: MatchSetup;
19
- /** Who comes in: the bound on the candidates, the fallback. */
20
- candidates: CandidateSetup;
21
- /** The order: the blend, field weights and boosts, boosts and buries. */
22
- ranking: RankingProxy;
23
- /** Ask the server to order a search no record holds every word of by the rarest words the records
24
- * hold (`?refocus=true`). useSearchOrAsk sets it while the judge reads a question or a description. */
25
- refocus?: boolean;
26
- minimumScore: number;
27
- showScore: boolean;
28
- placeholderText: string;
29
- }
30
- export interface SearchResult {
31
- document: any;
32
- documentKey: number;
33
- score: number;
34
- position: number;
35
- }
36
- export interface SearchState {
37
- query: string;
38
- results: SearchResult[] | null;
39
- isLoading: boolean;
40
- resultsSuppressed?: boolean;
41
- facetDebounceDelayMillis?: number;
42
- error?: string;
43
- errorInfo?: SearchErrorInfo;
44
- facets?: any | null;
45
- filterableFields: string[];
46
- facetableFields: string[];
47
- sortableFields: string[];
48
- fieldTypes: Record<string, string>;
49
- filters: Record<string, string[]>;
50
- valueMatch: Record<string, ValueMatch>;
51
- rangeFilters: Record<string, {
52
- min: number;
53
- max: number;
54
- }>;
55
- bucketFilters: Record<string, NumericRange[]>;
56
- fieldsSeeded: boolean;
57
- filterRevision: number;
58
- facetStats?: Record<string, {
59
- min: number;
60
- max: number;
61
- }>;
62
- rangeBounds: Record<string, {
63
- min: number;
64
- max: number;
65
- }>;
66
- sortBy?: string;
67
- sortAscending?: boolean;
68
- searchSettings: SearchSettings;
69
- countedTotal?: number;
70
- isFallback?: boolean;
71
- toleranceCounts?: ToleranceCounts | null;
72
- countedTolerance?: Tolerance | null;
73
- ranked?: number;
74
- reranked?: boolean;
75
- fill?: PageFill | null;
76
- totalDocumentCount?: number;
77
- queryId?: string;
78
- pick?: FacetPick;
79
- }
80
- /** A value ticked from its facet's own search field: the statistics' Journeys show it as a step,
81
- * with what was typed, a near match marked (server 6.0, Nov 2026). */
82
- export interface FacetPick {
83
- field: string;
84
- value: string;
85
- /** What was typed into the facet's search field. */
86
- text: string;
87
- /** The answer was the fallback: no value held every word typed, and the visitor knew this one. */
88
- fallback: boolean;
89
- /** The filterRevision of the tick: only the search it makes carries the pick. */
90
- revision: number;
91
- }
4
+ import { AskPicks, FacetValueHit, NumericRange, SearchResult, SearchSettings, SearchState, ValueMatch } from '../core/types';
5
+ export type { NumericRange, ValueMatch, SearchSettings, SearchResult, SearchState, FacetPick, FacetValueHit } from '../core/types';
6
+ export { DEFAULT_PLACEHOLDER, hierarchyKey, hierarchyPath } from '../core/types';
92
7
  export interface SearchContextType {
93
8
  state: SearchState;
94
9
  isFetchingInitial: boolean;
@@ -118,11 +33,23 @@ export interface SearchContextType {
118
33
  toggleBucketFilter: (field: string, range: NumericRange, exclusive?: boolean) => void;
119
34
  resetBucketFilter: (field: string, range?: NumericRange, isUserAction?: boolean) => void;
120
35
  setSort: (field: string | null, ascending: boolean) => void;
36
+ /** Chooses a path in a hierarchy (its level fields from the top): each level filtered to its
37
+ * value, the levels below cleared; an empty path clears it. Optional so a context built by hand
38
+ * stays valid; HierarchicalFilterPanel shows nothing without it. */
39
+ setHierarchy?: (fields: string[], path: string[]) => void;
40
+ /** Shows a numbered page, from 1 (SearchPagination). Optional, as setHierarchy, for providers of
41
+ * their own (a mock); SearchProvider always has it. */
42
+ setPage?: (page: number) => void;
43
+ /** Runs a change an AI agent made, so the search it causes goes marked as an agent's (actor=agent)
44
+ * when marking is on (SearchAgent's `mark`, 25 Nov 2026). The bindings call it; a page rarely does. */
45
+ runAsAgent?: (change: () => void) => void;
46
+ /** Switches the marking of agents' searches on or off. SearchAgent's `mark` sets it. */
47
+ setAgentMarking?: (on: boolean) => void;
121
48
  setDebounceDelay?: (ms: number) => void;
122
49
  setSearchSettings: (settings: Partial<SearchSettings>) => void;
123
50
  fetchMoreResults: (newMax: number) => void;
124
51
  selectResult?: (result: SearchResult) => Promise<void>;
125
- convertResult?: (documentKey: number, type: string, options?: {
52
+ convertResult?: (documentKey: number | string, type: string, options?: {
126
53
  queryId?: string;
127
54
  quantity?: number;
128
55
  }) => Promise<void>;
@@ -153,16 +80,8 @@ export interface SearchContextType {
153
80
  fallback: boolean;
154
81
  } | null>;
155
82
  }
156
- /** A value a facet search found, with how many records hold it. */
157
- export interface FacetValueHit {
158
- value: string;
159
- count: number;
160
- }
161
- /** The field's placeholder unless the page sets one. SearchInput says "Search or ask" instead
162
- * while asking is on, so it must know this one from a page's own. */
163
- export declare const DEFAULT_PLACEHOLDER = "Type to search";
164
83
  export declare const SearchContext: React.Context<SearchContextType | undefined>;
165
- export declare const SearchProvider: React.FC<{
84
+ export interface SearchProviderProps {
166
85
  children: React.ReactNode;
167
86
  url: string;
168
87
  team: string;
@@ -191,5 +110,11 @@ export declare const SearchProvider: React.FC<{
191
110
  * green ogre" searching "green ogre"). Called on every
192
111
  * render with the typed text; return it unchanged to search it as typed. */
193
112
  searchTextOf?: (typed: string) => string;
194
- }>;
113
+ }
114
+ /**
115
+ * The search for the components inside it: React's adapter over createSearch (25 Nov 2026), which
116
+ * holds the state and decides when to search. This renders it and passes the props on. A new url,
117
+ * team or dataset is a new search.
118
+ */
119
+ export declare const SearchProvider: React.FC<SearchProviderProps>;
195
120
  export declare const useSearchContext: () => SearchContextType;
@@ -0,0 +1,114 @@
1
+ import { SearchMode, MatchSetup, CandidateSetup, RankingProxy } from '@indxsearch/indx-types';
2
+ import { SearchErrorInfo } from '../context/searchError';
3
+ import { AskPicks, FacetValueHit, NumericRange, SearchResult, SearchSettings, SearchState, ValueMatch } from './types';
4
+ /** The options a search may change while it runs (an adapter passes its props on every render). */
5
+ export interface LiveSearchOptions {
6
+ allowEmptySearch?: boolean;
7
+ /** Read when initialisation runs (at start, or a retry after a failure). */
8
+ preAuthenticatedToken?: string;
9
+ facetDebounceDelayMillis?: number;
10
+ /** How the facet counts follow typing. `inFlight` (default, 18 Nov 2026): one facets-only search
11
+ * always on its way, the next sent as soon as it lands. `debounce`: one search with facets once
12
+ * typing pauses for `facetDebounceDelayMillis`. */
13
+ facetTiming?: 'inFlight' | 'debounce';
14
+ enableDebugLogs?: boolean;
15
+ /** Names this search surface in the statistics: a search box, an app ("header", "app"). */
16
+ source?: string;
17
+ /** The page's language for the statistics, a BCP 47 tag. Absent, the document's `lang`, else the browser's. */
18
+ locale?: string;
19
+ /** false: searches and selects from here are stored but not counted (a test page, an agent). */
20
+ count?: boolean;
21
+ /** The text to search for what is typed, when it is not the typed text itself. */
22
+ searchTextOf?: (typed: string) => string;
23
+ }
24
+ export interface SearchOptions extends LiveSearchOptions {
25
+ url: string;
26
+ team: string;
27
+ dataset: string;
28
+ maxResults?: number;
29
+ /** Fixed for the search's life. */
30
+ enableFacets?: boolean;
31
+ mode?: SearchMode;
32
+ match?: MatchSetup;
33
+ candidates?: CandidateSetup;
34
+ ranking?: RankingProxy;
35
+ }
36
+ /** What an adapter renders from. A new object on every change, the same one between changes. */
37
+ export interface SearchSnapshot {
38
+ state: SearchState;
39
+ /** True until the dataset has answered and its fields are in the state. */
40
+ isFetchingInitial: boolean;
41
+ /** Set when initialisation failed (bad token, unknown dataset, unreachable server). */
42
+ authError?: string;
43
+ authErrorInfo?: SearchErrorInfo;
44
+ /** Min and max per numeric field over the whole dataset; `state.rangeBounds` follows the query. */
45
+ datasetBounds: Record<string, {
46
+ min: number;
47
+ max: number;
48
+ }>;
49
+ /** The assistant's picks, while they are the list (for the text they were shown for). */
50
+ picks: AskPicks | null;
51
+ /** Moves each time the bearer token is set. React's hooks key their requests on authenticatedFetch,
52
+ * so its adapter hands out a new one when this moves: a request made before the token was there
53
+ * is made again once it is. */
54
+ tokenVersion: number;
55
+ }
56
+ export interface SearchController {
57
+ readonly url: string;
58
+ readonly team: string;
59
+ readonly dataset: string;
60
+ readonly sessionId: string;
61
+ readonly facetsEnabled: boolean;
62
+ readonly allowEmptySearch: boolean;
63
+ readonly source: string | undefined;
64
+ readonly count: boolean;
65
+ getSnapshot(): SearchSnapshot;
66
+ subscribe(listener: () => void): () => void;
67
+ /** Opens the dataset and runs the first search. Idempotent. */
68
+ start(): void;
69
+ /** Stops the timers. A later start() picks up again (React's StrictMode stops and starts once). */
70
+ stop(): void;
71
+ setOptions(options: LiveSearchOptions): void;
72
+ /** What the search runs on: the typed text, or what `searchTextOf` makes of it. */
73
+ searchText(): string;
74
+ authenticatedFetch(url: string, options?: RequestInit): Promise<Response>;
75
+ setQuery(query: string): void;
76
+ toggleFilter(field: string, value: string, exclusive?: boolean, pickedFrom?: {
77
+ text: string;
78
+ fallback: boolean;
79
+ }): void;
80
+ setValueMatch(field: string, match: ValueMatch): void;
81
+ setRangeFilter(field: string, min: number, max: number): void;
82
+ resetFilters(): void;
83
+ resetSingleFilter(field: string, value: string, isUserAction?: boolean): void;
84
+ resetRangeFilter(field: string, isUserAction?: boolean): void;
85
+ toggleBucketFilter(field: string, range: NumericRange, exclusive?: boolean): void;
86
+ resetBucketFilter(field: string, range?: NumericRange, isUserAction?: boolean): void;
87
+ setSort(field: string | null, ascending: boolean): void;
88
+ /** Chooses a path in a hierarchy (`fields`, its levels from the top): each level is filtered to
89
+ * its value and the levels below it cleared. An empty path clears the hierarchy. */
90
+ setHierarchy(fields: string[], path: string[]): void;
91
+ /** Shows a numbered page, from 1, of searchSettings.maxNumberOfRecordsToReturn records. Searches
92
+ * for the records alone: the count and the facets are the same on every page. A new query,
93
+ * filter, sort or setting goes back to the first page. */
94
+ setPage(page: number): void;
95
+ setDebounceDelay(ms: number): void;
96
+ setSearchSettings(settings: Partial<SearchSettings>): void;
97
+ fetchMoreResults(newMax: number): void;
98
+ /** Tries again after a failure: initialisation when that failed, otherwise the last search. */
99
+ retry(): void;
100
+ selectResult(result: SearchResult): Promise<void>;
101
+ convertResult(documentKey: number | string, type: string, options?: {
102
+ queryId?: string;
103
+ quantity?: number;
104
+ }): Promise<void>;
105
+ searchFacetValues(field: string, text: string, rows: number, among?: string[]): Promise<{
106
+ values: FacetValueHit[];
107
+ fallback: boolean;
108
+ } | null>;
109
+ runAsAgent(change: () => void): void;
110
+ setAgentMarking(on: boolean): void;
111
+ showPicks(picks: AskPicks | null): void;
112
+ searchAsTyped(): void;
113
+ }
114
+ export declare function createSearch(options: SearchOptions): SearchController;
@@ -0,0 +1,9 @@
1
+ export { createSearch } from './createSearch';
2
+ export type { SearchController, SearchOptions, LiveSearchOptions, SearchSnapshot } from './createSearch';
3
+ export { initializeDataset } from './initializeDataset';
4
+ export type { DatasetInfo, InitializeOptions } from './initializeDataset';
5
+ export { DEFAULT_PLACEHOLDER, hierarchyKey, hierarchyPath, pageCount, MAX_PAGEABLE } from './types';
6
+ export type { SearchState, SearchSettings, SearchResult, FacetPick, FacetValueHit, NumericRange, ValueMatch, AskPick, AskPicks, AskFilters, } from './types';
7
+ export { IndxApiError } from '../context/IndxApiError';
8
+ export { describeSearchError, SearchSetupError } from '../context/searchError';
9
+ export type { SearchErrorInfo, SearchErrorKind } from '../context/searchError';
@@ -1,13 +1,6 @@
1
- import { SearchErrorInfo } from './searchError';
2
- export interface IndxAuthResult {
3
- token: string | null;
4
- isFetchingInitial: boolean;
5
- /** Set when initialization failed (bad token, unknown dataset, unreachable server). */
6
- authError: string | null;
7
- /** The same failure, classified: what kind it was, whether retrying can help, and a technical line. */
8
- authErrorInfo: SearchErrorInfo | null;
9
- /** Runs initialisation again, after a failure. */
10
- retry: () => void;
1
+ /** What a dataset says about itself before the first search: its fields by role, their types, the
2
+ * bounds and values of its facets over every record, and its size. */
3
+ export interface DatasetInfo {
11
4
  initialFacetStats: Record<string, {
12
5
  min: number;
13
6
  max: number;
@@ -26,12 +19,18 @@ export interface IndxAuthResult {
26
19
  fieldTypes: Record<string, string>;
27
20
  totalDocumentCount: number;
28
21
  }
29
- interface UseIndxAuthOptions {
22
+ export interface InitializeOptions {
30
23
  url: string;
31
24
  team: string;
32
25
  dataset: string;
33
26
  preAuthenticatedToken?: string;
34
27
  enableDebugLogs?: boolean;
28
+ /** Called once the dataset has answered, before the fields are read: searches may go from then. */
29
+ onToken: (token: string) => void;
35
30
  }
36
- export declare function useIndxAuth({ url, team, dataset, preAuthenticatedToken, enableDebugLogs, }: UseIndxAuthOptions): IndxAuthResult;
37
- export {};
31
+ /**
32
+ * Opens a dataset for searching: checks it exists and the key reaches it, then reads its fields and
33
+ * a blank search's facets. Throws on a failure, explained on the console; the caller keeps it as
34
+ * the search's setup error. No framework: createSearch runs it (until 25 Nov 2026 useIndxAuth).
35
+ */
36
+ export declare function initializeDataset({ url, team, dataset, preAuthenticatedToken, enableDebugLogs, onToken, }: InitializeOptions): Promise<DatasetInfo>;
@@ -0,0 +1,153 @@
1
+ import { SearchMode, MatchSetup, CandidateSetup, RankingProxy, ToleranceCounts, PageFill, Tolerance } from '@indxsearch/indx-types';
2
+ import { SearchErrorInfo } from '../context/searchError';
3
+ import { ValueMatch, NumericRange } from '../context/buildFilterProxy';
4
+ export type { ValueMatch, NumericRange };
5
+ /**
6
+ * What every search from this provider is asked with: the query's mode and its three parts, as
7
+ * the server takes them (6.0). The mode, or a member of a part, left out is the dataset's on the
8
+ * server (its query parameters), else the engine default, so a page sets only what it means to
9
+ * decide itself: every value it sends wins over the dataset's.
10
+ */
11
+ export interface SearchSettings {
12
+ maxNumberOfRecordsToReturn: number;
13
+ /** Left out: the dataset's mode, else EditDistance. */
14
+ mode?: SearchMode;
15
+ /** What counts as a hit: tolerance, rungs, the word being typed. */
16
+ match: MatchSetup;
17
+ /** Who comes in: the bound on the candidates, the fallback. */
18
+ candidates: CandidateSetup;
19
+ /** The order: the blend, field weights and boosts, boosts and buries. */
20
+ ranking: RankingProxy;
21
+ /** Ask the server to order a search no record holds every word of by the rarest words the records
22
+ * hold (`?refocus=true`). useSearchOrAsk sets it while the judge reads a question or a description. */
23
+ refocus?: boolean;
24
+ minimumScore: number;
25
+ showScore: boolean;
26
+ placeholderText: string;
27
+ }
28
+ export interface SearchResult {
29
+ document: any;
30
+ documentKey: number;
31
+ key?: string;
32
+ score: number;
33
+ position: number;
34
+ }
35
+ export interface SearchState {
36
+ query: string;
37
+ results: SearchResult[] | null;
38
+ isLoading: boolean;
39
+ resultsSuppressed?: boolean;
40
+ facetDebounceDelayMillis?: number;
41
+ error?: string;
42
+ errorInfo?: SearchErrorInfo;
43
+ facets?: any | null;
44
+ filterableFields: string[];
45
+ facetableFields: string[];
46
+ sortableFields: string[];
47
+ fieldTypes: Record<string, string>;
48
+ filters: Record<string, string[]>;
49
+ valueMatch: Record<string, ValueMatch>;
50
+ rangeFilters: Record<string, {
51
+ min: number;
52
+ max: number;
53
+ }>;
54
+ bucketFilters: Record<string, NumericRange[]>;
55
+ fieldsSeeded: boolean;
56
+ filterRevision: number;
57
+ facetStats?: Record<string, {
58
+ min: number;
59
+ max: number;
60
+ }>;
61
+ rangeBounds: Record<string, {
62
+ min: number;
63
+ max: number;
64
+ }>;
65
+ sortBy?: string;
66
+ sortAscending?: boolean;
67
+ searchSettings: SearchSettings;
68
+ countedTotal?: number;
69
+ isFallback?: boolean;
70
+ toleranceCounts?: ToleranceCounts | null;
71
+ countedTolerance?: Tolerance | null;
72
+ ranked?: number;
73
+ reranked?: boolean;
74
+ fill?: PageFill | null;
75
+ totalDocumentCount?: number;
76
+ queryId?: string;
77
+ pick?: FacetPick;
78
+ /** The hierarchies a page shows (HierarchicalFilterPanel), each its level fields from the top,
79
+ * keyed by hierarchyKey. A level holds one chosen value at most, in `filters`; a chosen level's
80
+ * siblings are counted apart, so the menu keeps them (25 Nov 2026). */
81
+ hierarchies?: Record<string, string[]>;
82
+ /** The numbered page shown, from 1 (setPage); left out, the first. Its size is the page size the
83
+ * visitor chose (maxResults, or setSearchSettings'). A new query, filter, sort or setting goes
84
+ * back to the first (26 Nov 2026). */
85
+ page?: number;
86
+ }
87
+ /** A value ticked from its facet's own search field: the statistics' Journeys show it as a step,
88
+ * with what was typed, a near match marked (server 6.0, Nov 2026). */
89
+ export interface FacetPick {
90
+ field: string;
91
+ value: string;
92
+ /** What was typed into the facet's search field. */
93
+ text: string;
94
+ /** The answer was the fallback: no value held every word typed, and the visitor knew this one. */
95
+ fallback: boolean;
96
+ /** The filterRevision of the tick: only the search it makes carries the pick. */
97
+ revision: number;
98
+ }
99
+ /** A value a facet search found, with how many records hold it. */
100
+ export interface FacetValueHit {
101
+ value: string;
102
+ count: number;
103
+ }
104
+ /** The key a hierarchy is held under in `SearchState.hierarchies`. */
105
+ export declare function hierarchyKey(fields: string[]): string;
106
+ /** The chosen path of a hierarchy: each level's value from the top, while there is one. */
107
+ export declare function hierarchyPath(state: Pick<SearchState, 'filters'>, fields: string[]): string[];
108
+ /** The field's placeholder unless the page sets one. SearchInput says "Search or ask" instead
109
+ * while asking is on, so it must know this one from a page's own. */
110
+ export declare const DEFAULT_PLACEHOLDER = "Type to search";
111
+ /** A record the assistant picked for the page's list, numbered as the answer cites it ([n]), with
112
+ * why it was picked. */
113
+ export interface AskPick {
114
+ n: number;
115
+ documentKey: number;
116
+ /** The key as text (6.0); look a text key up by it. */
117
+ key?: string;
118
+ title: string;
119
+ why: string;
120
+ }
121
+ /** On a catalogue, the records the assistant picked by reading them: the page's list while the
122
+ * conversation is open. `search` is the search behind them when the visitor asked for all of
123
+ * something (every private school in a town), so the page can offer all it found. `askId` names
124
+ * the answer, for reporting a pick that is opened. */
125
+ export interface AskPicks {
126
+ picks: AskPick[];
127
+ search?: AskFilters | null;
128
+ askId?: string;
129
+ }
130
+ /** What a catalogue's description was searched with: filters, words no filter covers, and the count. */
131
+ export interface AskFilters {
132
+ filters: {
133
+ field: string;
134
+ value?: string | null;
135
+ min?: number | null;
136
+ max?: number | null;
137
+ }[];
138
+ text: string;
139
+ /** An order the description asked for ("the largest"): a Sortable field. */
140
+ sort?: {
141
+ field: string;
142
+ descending: boolean;
143
+ } | null;
144
+ found: number;
145
+ /** True when the count is a cap: there are more. */
146
+ more: boolean;
147
+ }
148
+ /** The most records a search ranks (the library's candidate roof, SearchEngine.CandidatesRoof): a
149
+ * page past them comes back empty whatever the count says, so the pages stop there. */
150
+ export declare const MAX_PAGEABLE = 5000;
151
+ /** How many numbered pages the last search has, at the page size it was asked with: its count,
152
+ * else (the fallback, Bm25f mode) what it ranked, up to MAX_PAGEABLE. 0 before a search. */
153
+ export declare function pageCount(state: Pick<SearchState, 'countedTotal' | 'ranked' | 'results' | 'searchSettings' | 'page'>): number;
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./createSearch-DTzFwekh.js");exports.DEFAULT_PLACEHOLDER=e.n,exports.IndxApiError=e.f,exports.MAX_PAGEABLE=e.r,exports.SearchSetupError=e.u,exports.createSearch=e.t,exports.describeSearchError=e.d,exports.hierarchyKey=e.i,exports.hierarchyPath=e.a,exports.initializeDataset=e.s,exports.pageCount=e.o;
package/dist/core.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './core/index.js'
2
+ export {}
@@ -0,0 +1 @@
1
+ export { n as DEFAULT_PLACEHOLDER, f as IndxApiError, r as MAX_PAGEABLE, u as SearchSetupError, t as createSearch, d as describeSearchError, i as hierarchyKey, a as hierarchyPath, s as initializeDataset, o as pageCount } from "./createSearch-DErfMd90.mjs";