@@ -2,10 +2,10 @@ import { range, unique, windowed } from '@pacote/array'
22import { BloomFilter , optimal } from '@pacote/bloom-filter'
33import { memoize } from '@pacote/memoize'
44import type { U64 } from '@pacote/u64'
5- import { type XXHash , xxh64 } from '@pacote/xxhash'
5+ import { xxh64 , type XXHash } from '@pacote/xxhash'
66import { findLast } from './array'
77import { entries , keys , pick } from './object'
8- import { EXCLUDE , PHRASE , REQUIRE , queryTerms } from './query'
8+ import { EXCLUDE , PHRASE , queryTerms , REQUIRE } from './query'
99import { countIdf } from './tf-idf'
1010
1111export type PreprocessFunction < Document , Field extends keyof Document > = (
@@ -23,7 +23,10 @@ export type TokenizerFunction = (token: string, language?: string) => string[]
2323 * @template Document The type of document being indexed.
2424 * @template SummaryField The document keys that can be returned in search results.
2525 */
26- export type IndexedDocument < Document , SummaryField extends keyof Document > = {
26+ export interface IndexedDocument <
27+ Document ,
28+ SummaryField extends keyof Document ,
29+ > {
2730 /**
2831 * Summary fields for the document. These are preserved as-is.
2932 */
@@ -35,7 +38,7 @@ export type IndexedDocument<Document, SummaryField extends keyof Document> = {
3538 readonly signatures : Record < number , BloomFilter < string > >
3639}
3740
38- export type Index < Document , SummaryField extends keyof Document > = {
41+ export interface Index < Document , SummaryField extends keyof Document > {
3942 version : number
4043 documents : Record < string , IndexedDocument < Document , SummaryField > >
4144}
@@ -47,11 +50,11 @@ export type Index<Document, SummaryField extends keyof Document> = {
4750 * @template SummaryField The document keys that can be returned in search results.
4851 * @template IndexField The document keys to be indexed for searching.
4952 */
50- export type Options <
53+ export interface Options <
5154 Document extends Record < string , unknown > ,
5255 SummaryField extends keyof Document = keyof Document ,
5356 IndexField extends keyof Document = keyof Document ,
54- > = {
57+ > {
5558 /**
5659 * The fields to index, provided as an array or as a record of field keys and
5760 * weight values.
@@ -117,13 +120,13 @@ export type Options<
117120 tokenizer ?: TokenizerFunction
118121}
119122
120- type SearchTokens = {
123+ interface SearchTokens {
121124 required : string [ ]
122125 included : string [ ]
123126 excluded : string [ ]
124127}
125128
126- type Result < Document , SummaryField extends keyof Document > = {
129+ interface Result < Document , SummaryField extends keyof Document > {
127130 readonly summary : Pick < Document , SummaryField >
128131 readonly score : number
129132}
0 commit comments