@indxsearch/indx-types
v2.3.0
Published
TypeScript type definitions for Indx v2. Provides complete types for search queries, filters, boosts, results, and system status based on the official Swagger specification.
Maintainers
Readme
@indxsearch/indx-types
TypeScript type definitions for Indx v2.0. This package provides complete, strongly-typed interfaces for search queries, filters, boosts, results, and system status.
Installation
npm install @indxsearch/indx-typesFeatures
- Complete TypeScript type definitions for Indx v2.0
- Zero runtime dependencies (types-only package)
- Matches official Swagger API specification exactly
- Full IntelliSense support in VS Code and other IDEs
- Supports both ESM and CommonJS
Version Compatibility
This package (@indxsearch/indx-types 2.x) provides types for Indx v2.0 (IndxSearchLib v5). The shapes are generated from and verified against the live v5 OpenAPI spec.
Usage
Basic Query
import type { QueryProxy, Result } from '@indxsearch/indx-types';
const query: QueryProxy = {
text: 'search term',
maxNumberOfRecordsToReturn: 10,
};
// Use with your API client
const result: Result = await apiClient.search(query);Filters
import type {
RangeFilterProxy,
ValueFilterProxy,
CombinedFilterProxy
} from '@indxsearch/indx-types';
// Range filter
const rangeFilter: RangeFilterProxy = {
fieldName: 'price',
lowerLimit: 10,
upperLimit: 100
};
// Value filter
const valueFilter: ValueFilterProxy = {
fieldName: 'category',
value: 'electronics'
};
// Combined filter
const combinedFilter: CombinedFilterProxy = {
a: rangeFilter,
b: valueFilter,
useAndOperation: true
};Boosts
import type { BoostProxy, BoostStrength } from '@indxsearch/indx-types';
const boost: BoostProxy = {
boostStrength: BoostStrength.High,
filterProxy: {
hashString: 'filter-hash'
}
};
const query: QueryProxy = {
text: 'search term',
enableBoost: true,
boosts: [boost]
};Coverage Setup
import type { CoverageSetup, QueryProxy } from '@indxsearch/indx-types';
const coverageSetup: CoverageSetup = {
coverWholeQuery: true,
coverWholeWords: true,
coverFuzzyWords: true,
minWordSize: 2,
levenshteinMaxWordSize: 20,
truncate: true,
truncationScore: 255
};
const query: QueryProxy = {
text: 'search term',
enableCoverage: true,
coverageSetup
};System Status
import type { SystemStatus, SystemState } from '@indxsearch/indx-types';
const status: SystemStatus = await apiClient.getStatus();
if (status.systemState === SystemState.Ready) {
console.log('System is ready');
console.log(`Documents indexed: ${status.documentCount}`);
}API Reference
Types
Query Types
QueryProxy- Main search query interfaceCoverageSetup- Coverage configuration options
Filter Types
FilterProxy- Base filter interfaceRangeFilterProxy- Numeric range filterValueFilterProxy- Value-based filterCombinedFilterProxy- Combined filter with AND/OR operationsUpdateFieldProxy- Field value update payload (fieldName,value)FilterFieldUpdateProxy- Field update applied to documents matching a filter
Result Types
Result- Search result interfaceScoreEntry- Individual result entry with score
Field Types
FieldProxy- Field metadata and indexing flags (searchable, filterable, weight, BM25 params)
Boost Types
BoostProxy- Search result boost configurationQueryProxy.fieldBoosts- Per-field boost map (Record<string, number>) onQueryProxy
Vector / Hybrid Types
VectorQueryProxy- Embedding vector search query (field, vector, max results, filter)HybridQueryProxy- Combined text + vector search query withalphablendEmbeddingResultEntry- Single vector match (documentKey,score)
Status Types
SystemStatus- System status and health informationLicenseInfo- License validation details
Authentication
Auth is bearer-token only — create a token on the Indx Dashboard and pass it as preAuthenticatedToken. The email/password login flow is deprecated and being removed.
ChangePasswordRequest- Password change payload (currentPassword,newPassword)LoginInfo/LoginResponse- Deprecated — legacy email/password login types, being removed in favour of token-only auth.
Error Types
ParseResult- JSON parse outcome for a token (progress, record index, error info)ProcessError- A processing error (source,message, optionalparseError)ProcessErrorCount- AProcessErrorpaired with its occurrencecount
Dataset Types
DataSetListDto- A dataset fromGET /api/me/datasets: itsname, the owningteamName, and the caller'srole("Admin" | "Editor" | "Viewer")
Common Types
StringInt32KeyValuePair-{ key: string; value: number }pairStringSingleValueTuple-{ Item1: string; Item2: number }tuple
Enums
SystemState
Hibernated = -1Created = 0Loading = 1Loaded = 2Indexing = 3Ready = 4Error = 255
BoostStrength
Low = 1Medium = 2High = 3
JsonErrorType
None = 0ControlCharacters = 1TrailingComma = 2UnescapedQuotes = 3UnescapedBackslash = 4StructuralError = 5UnknownError = 6
TypeScript Configuration
This package is designed to work seamlessly with TypeScript. Add it to your tsconfig.json:
{
"compilerOptions": {
"types": ["@indxsearch/indx-types"]
}
}For monorepo development with path mapping:
{
"compilerOptions": {
"paths": {
"@indxsearch/indx-types": ["../indx-types/src"]
}
}
}Related Packages
- @indxsearch/intrface - React search UI components
- @indxsearch/systm - Core search system
- @indxsearch/pixl - UI component library
Documentation
License
Apache-2.0
Contributing
This package is part of the indx-react monorepo. See the main repository for contribution guidelines.
