Querylight TS Demo

Documentation

Browse the static Querylight TS documentation pages or use the interactive search experience.

Documentation

Static article pages

Use the interactive search on the home page, or browse documentation entries directly below.

API Reference

Generated symbol-level API docs

Browse TSDoc-backed reference pages for exported classes, interfaces, queries, helpers, and types.

API Reference

AnalyzedToken

Token with original source offsets for highlighting and phrase work.

API Reference

Analyzer

Configurable analyzer pipeline used by text indexes and query parsing.

Analysis

Analyzer and Tokenization Deep Dive

Understand how tokenization and token filters change matching behavior, recall, and precision.

Analysis

Analyzers, Tokenizers, and Filters

Normalization is explicit, so you can tailor indexing and querying behavior per field.

API Reference

andHits

Intersects two hit lists and adds scores for matching documents.

API Reference

API Reference

Generated symbol-level API documentation for the published Querylight TS surface.

API Reference

applyBoost

Applies a multiplicative boost to every hit score.

Other Features

Approximate Nearest Neighbor Vector Search

Use VectorFieldIndex and bigramVector for lightweight semantic-ish lookup.

Demo Internals

Article Length Facets in the Demo

How the demo calculates article word count, builds numeric buckets, and turns them into live sidebar filters.

Demo Internals

Ask the Docs End to End

How the demo builds semantic embeddings, ships them to the browser, and answers natural-language questions locally.

API Reference

AsyncVectorScorer

Optional async scoring extension for backends such as WebGPU.

Aggregations

Avg Aggregation

Compute the arithmetic mean of indexed numeric or date values, optionally within the current result set.

API Reference

bigramVector

Creates a fixed-size bigram-count vector from analyzed text or tokens.

API Reference

Bm25Config

BM25 scoring configuration.

API Reference

BoolQuery

Boolean composition query with Elasticsearch-style should/must/filter/mustNot semantics.

Lexical Querying

BoolQuery for Must, Should, Filter, MustNot, and MinimumShouldMatch

Blend ranking clauses with strict filters, exclusions, and optional should-logic in one request.

API Reference

BoolQueryParams

Parameters for constructing a BoolQuery.

API Reference

BoostingQuery

Query wrapper that softly demotes hits matching a negative clause.

Lexical Querying

BoostingQuery for Soft Demotion Instead of Hard Exclusion

Keep relevant documents in the results while pushing down candidates that carry undesirable signals.

API Reference

BoostingQueryParams

Parameters for constructing a BoostingQuery.

Guides

Build Interactive ECharts Dashboards from Plain JSON

Use Querylight TS to turn plain JSON records into the filtered series and buckets that Apache ECharts expects.

Schema

Choosing a Schema for Search

Model titles, body text, filters, tags, and helper fields so search behavior stays predictable.

Overview

Comparing Querylight TS to Other Browser Search Libraries

A practical overview of strengths and weak points for Querylight TS, Fuse.js, Lunr, MiniSearch, FlexSearch, Pagefind, and Orama.

API Reference

cosineSimilarity

Computes cosine similarity for two equal-length vectors.

API Reference

CpuVectorScorer

Default CPU scorer that uses normalized float32 vectors and dot-product scoring.

API Reference

createSeededRandom

Creates a deterministic pseudo-random number generator from a numeric seed.

API Reference

createSimpleTextSearchIndex

Builds a ready-to-use lexical, suggest, and fuzzy search bundle from plain JSON documents.

API Reference

CreateSimpleTextSearchIndexOptions

Options for building a beginner-friendly text search bundle.

Aggregations

Date Histogram Aggregation

Bucket date fields into fixed-width time intervals for timelines and recency views.

API Reference

DateFieldIndex

Structured date field index with range filters and date histograms.

API Reference

DateFieldIndexState

Serialized state for DateFieldIndex.

API Reference

DateHistogramBucket

Date histogram bucket.

API Reference

decodeGeohash

Decodes a geohash to the center point of its bounding box.

API Reference

decodeGeohashBounds

Decodes a geohash to its bounding box.

API Reference

defaultBm25Config

Default BM25 configuration used by text indexes.

API Reference

DisMaxQuery

Best-field query that keeps the strongest clause dominant with an optional tie breaker.

Lexical Querying

DisMaxQuery for Best-Field Matching with Tie Breakers

Prefer the strongest matching clause while still giving partial credit to secondary matches.

API Reference

DisMaxQueryParams

Parameters for constructing a DisMaxQuery.

API Reference

DistanceFeatureQuery

Numeric/date feature query that boosts values closest to an origin.

Ranking

DistanceFeatureQuery for Recency and Numeric Closeness

Boost documents by how close a numeric or date field is to an origin value.

API Reference

DistanceFeatureQueryParams

Parameters for constructing a DistanceFeatureQuery.

API Reference

Document

Stored document shape used by DocumentIndex.

Other Features

Document Chunking Strategies

Split long documents into meaningful sections so lexical retrieval, highlighting, and vector search stay focused.

Overview

Documentation Index

A section-by-section map of the Querylight TS documentation.

API Reference

DocumentIndex

Top-level document store that coordinates field indexes, search, highlighting, and serialization.

API Reference

DocumentIndexState

Serialized state for a full DocumentIndex.

API Reference

eastGeohash

Returns the neighboring geohash directly east of the provided hash.

API Reference

EdgeNgramsTokenFilter

Produces edge n-grams from the start and end of each token.

API Reference

ElisionTextFilter

Removes apostrophes and elision markers.

API Reference

encodeGeohash

Encodes a latitude/longitude coordinate into a geohash string.

API Reference

ExistsQuery

Filter that matches documents where a field has at least one stored value.

API Reference

ExistsQueryParams

Parameters for constructing an ExistsQuery.

API Reference

FieldIndex

Common interface implemented by all field indexes.

Guides

From Raw API Payloads to Browser Dashboards

A practical pattern for turning raw API responses into local-first dashboard interactions with Querylight TS.

API Reference

generateRandomVector

Creates a random vector of the requested dimensionality.

Other Features

Geo Indexing with Points and Polygons

Store GeoJSON and query by point containment or polygon intersection.

API Reference

GeoFieldIndex

GeoJSON field index backed by geohashes for point and polygon querying.

API Reference

GeoFieldIndexState

Serialized state for GeoFieldIndex.

API Reference

geohashContains

Returns `true` when a point falls inside the geohash cell.

API Reference

geohashesForGeometry

Collects geohashes that cover or intersect the provided geometry.

API Reference

Geometry

Supported geometry shapes for geo indexing and querying.

API Reference

geometryContainsPoint

Returns `true` when a geometry contains the given latitude/longitude point.

API Reference

geometryIntersectsGeohash

Returns `true` when a geometry intersects the provided geohash cell.

API Reference

geometryIntersectsPolygon

Returns `true` when a geometry intersects the provided polygon.

API Reference

GeoPointQuery

Geo query that matches documents containing a point.

API Reference

GeoPointQueryParams

Parameters for constructing a GeoPointQuery.

API Reference

GeoPolygonQuery

Geo query that matches documents intersecting a polygon.

API Reference

GeoPolygonQueryParams

Parameters for constructing a GeoPolygonQuery.

Overview

Getting Started with Browser Search

Build a practical search box quickly with either the beginner helper or the equivalent manual setup.

API Reference

hashFunction

Hashes a vector against a list of random projection vectors.

API Reference

HighlightClause

Highlight clause emitted by queries that support highlighting.

API Reference

HighlightFieldResult

Highlight results for one field.

API Reference

HighlightFragment

Highlight fragment returned for one stored field value.

API Reference

HighlightFragmentPart

Plain or highlighted segment within a returned fragment.

Other Features

Highlighting with Querylight TS

Generate exact, phrase, prefix, and fuzzy highlight fragments after retrieval using stored source offsets.

API Reference

HighlightRequest

Options for `DocumentIndex.highlight(...)`.

API Reference

HighlightResult

Highlight response payload.

API Reference

HighlightSpan

Highlighted span within a stored field value.

Aggregations

Histogram Aggregation

Bucket numeric fields into regular fixed-width intervals for charts and sidebar facets.

API Reference

Hit

`[documentId, score]` tuple returned by search operations.

API Reference

Hits

Ordered list of scored hits.

Demo Internals

How the Aggregations Sidebar Works

How the demo calculates live text facets, word-count buckets, and significant terms for the right-hand sidebar.

Guides

How To Build Autocomplete

Use prefix-friendly fields, compact suggestion text, and stable ranking for search-as-you-type.

Guides

How To Build Faceted Navigation

Use text, numeric, and date aggregations over the current hit set to drive filters, counts, and exploratory navigation.

API Reference

ids

Extracts document ids from an ordered hit list.

API Reference

IndexState

Union of all serialized field index state payloads.

API Reference

IndexStateBase

Common base type for serialized field index state.

API Reference

InterpunctionTextFilter

Replaces punctuation with spaces before tokenization.

Overview

Introducing Querylight TS

Why this TypeScript port exists, who it is for, and where it fits relative to established search tools.

API Reference

KeywordTokenizer

Tokenizer that keeps the full input as a single token.

Demo Internals

Lazy Indexing in the Dashboard Demo

How the dashboard route delays index construction until a section is actually viewed.

API Reference

LowerCaseTextFilter

Lowercases input text before tokenization.

API Reference

MatchAll

Query that matches every indexed document.

API Reference

MatchAllParams

Parameters for constructing a MatchAll.

API Reference

MatchPhrase

Phrase query with optional slop.

API Reference

MatchPhraseParams

Parameters for constructing a MatchPhrase.

API Reference

MatchQuery

Full-text query against one field using analyzed terms and optional prefix expansion.

API Reference

MatchQueryParams

Parameters for constructing a MatchQuery.

Aggregations

Max Aggregation

Get the largest indexed numeric or date value, optionally restricted to the current result set.

Aggregations

Min Aggregation

Get the smallest indexed numeric or date value, optionally restricted to the current result set.

API Reference

MultiMatchQuery

Full-text query that allows analyzed terms to match across multiple fields.

API Reference

MultiMatchQueryParams

Parameters for constructing a MultiMatchQuery.

API Reference

MultiPolygonCoordinates

Multi-polygon coordinates in GeoJSON-compatible form.

API Reference

NgramTokenFilter

Produces character n-grams from token streams.

API Reference

normalizedBoost

Resolves `undefined` boosts to a neutral multiplier of `1.0`.

API Reference

normalizeVector

Returns a unit-length copy of the provided vector.

API Reference

northGeohash

Returns the neighboring geohash directly north of the provided hash.

API Reference

NumericFieldIndex

Structured numeric field index with range filters and numeric aggregations.

Indexing

NumericFieldIndex and DateFieldIndex for Structured Features

Map numeric and date fields explicitly so range queries, ranking features, and aggregations behave predictably.

API Reference

NumericFieldIndexState

Serialized state for NumericFieldIndex.

API Reference

NumericHistogramBucket

Numeric histogram bucket.

API Reference

NumericRangeAggregationBucket

Materialized numeric range aggregation bucket.

API Reference

NumericRangeAggregationRange

One configured bucket in a numeric range aggregation.

API Reference

NumericStatsAggregation

Aggregate statistics over numeric values.

API Reference

OP

Boolean operator used by text queries that combine multiple analyzed terms.

API Reference

orHits

Unions two hit lists and sums scores for duplicate documents.

Overview

Other Work Related to Querylight TS

A map of adjacent projects by Jilles van Gurp around search, ranking, Elasticsearch, geo, and DSL tooling.

Operations

Performance and Memory Tuning

Control index size and query cost by choosing fields, analyzers, and precomputation strategies carefully.

Lexical Querying

Phrase Search and Slop

Match analyzed terms in sequence, with optional movement tolerance.

API Reference

PolygonCoordinates

Polygon coordinates in GeoJSON-compatible ring form.

API Reference

populateLSHBuckets

Populates LSH buckets for a single vector per id.

Indexing

Portable JSON Index State

Serialize index structures and hydrate them again without reindexing.

API Reference

PrefixQuery

Prefix lookup query over trie-backed text fields.

API Reference

PrefixQueryParams

Parameters for constructing a PrefixQuery.

API Reference

PreparedVector

Prepared vector storage used by vector scorers.

API Reference

Query

Minimal query contract implemented by all query classes.

API Reference

QueryContext

Mutable search context used to carry filter/include/exclude state across nested queries.

API Reference

RandomSource

Zero-argument random-number source returning values in `[0, 1)`.

Aggregations

Range Aggregation

Bucket numeric or date fields into explicit ranges for faceting and filtered navigation.

API Reference

RangeQuery

Range query for lexical, numeric, or date fields.

Lexical Querying

RangeQuery Over Lexical Fields

Filter sortable string terms with gt, gte, lt, and lte boundaries.

API Reference

RangeQueryParams

Parameters for constructing a RangeQuery.

API Reference

RankFeatureLinearOptions

Linear rank feature scoring configuration.

API Reference

RankFeatureLogOptions

Logarithmic rank feature scoring configuration.

API Reference

RankFeatureOptions

Supported rank feature scoring modes.

API Reference

RankFeatureQuery

Numeric feature query for saturation, log, sigmoid, or linear boosting.

Ranking

RankFeatureQuery for Numeric Relevance Signals

Boost documents with numeric features such as popularity, clicks, or quality scores.

API Reference

RankFeatureQueryParams

Parameters for constructing a RankFeatureQuery.

API Reference

RankFeatureSaturationOptions

Saturation-style rank feature scoring configuration.

API Reference

RankFeatureSigmoidOptions

Sigmoid rank feature scoring configuration.

API Reference

RankingAlgorithm

Built-in scoring algorithms for lexical ranking.

Guides

Real-World Recipes

Practical patterns for docs search, blog search, product filtering, related content, and lightweight semantic retrieval.

Ranking

Reciprocal Rank Fusion

Combine multiple ranked result lists from lexical, filtered, geo, or vector search.

API Reference

reciprocalRankFusion

Combines multiple ranked lists using reciprocal rank fusion.

API Reference

ReciprocalRankFusionOptions

Tuning options for reciprocal rank fusion.

API Reference

rectangleToPolygon

Builds a rectangular polygon from min/max lon/lat bounds.

API Reference

RegexpQuery

Regular-expression query over indexed terms.

Lexical Querying

RegexpQuery for Term-Level Regular Expressions

Match indexed terms with JavaScript regular expressions when wildcard patterns are not expressive enough.

API Reference

RegexpQueryParams

Parameters for constructing a RegexpQuery.

Ranking

Relevance Tuning with BM25, TF-IDF, and RRF

Choose ranking strategies deliberately and combine lexical, field, feature, and scripted signals without losing control.

API Reference

ScriptExecutionContext

Runtime values exposed to ScriptQuery and ScriptScoreQuery callbacks.

API Reference

ScriptFilter

Predicate callback used by ScriptQuery.

API Reference

ScriptQuery

Custom JavaScript predicate query.

Lexical Querying

ScriptQuery for Custom JavaScript Filters

Filter documents with a JavaScript function when built-in query classes do not express the rule cleanly.

API Reference

ScriptQueryParams

Parameters for constructing a ScriptQuery.

API Reference

ScriptScore

Scoring callback used by ScriptScoreQuery.

API Reference

ScriptScoreQuery

Query wrapper that replaces the base score with a custom script score.

Ranking

ScriptScoreQuery for Custom JavaScript Scoring

Rescore matching documents with a JavaScript function that combines `_score` with your own business logic.

API Reference

ScriptScoreQueryParams

Parameters for constructing a ScriptScoreQuery.

Overview

Search Engine Techniques for Analytics UIs

How search-style filtering and aggregation patterns translate naturally into exploratory analytics interfaces.

API Reference

SearchRequest

Request object for paginated searching.

Indexing

Serialization, Hydration, and Shipping Indexes

Prebuild index state, ship JSON to the client, and rehydrate fast without reindexing in the browser.

Aggregations

Significant Terms Aggregation

Surface terms that are unusually common in the current subset compared to the background corpus.

API Reference

SignificantTermsBucket

Significant-terms bucket comparing subset and background frequency.

API Reference

SimpleStringTrie

Simple trie implementation for prefix lookup and completion.

API Reference

simpleTextSearch

Runs the default simple-text-search strategy against a bundle created by createSimpleTextSearchIndex.

Other Features

SimpleTextSearch for Plain JSON Documents

A beginner path that builds a usable index from plain objects and runs a good-enough default search.

API Reference

SimpleTextSearchIndex

Bundle returned by createSimpleTextSearchIndex.

API Reference

SimpleTextSearchRequest

Request object for simpleTextSearch.

Guides

Slicing and Dicing Open Data with Querylight TS

Use small open-data snapshots to prototype interactive analytics in the browser with Querylight TS.

API Reference

SplittingTokenizer

Whitespace tokenizer for ordinary text analysis.

Aggregations

Stats Aggregation

Get count, min, max, sum, and average from a numeric or date field in one call.

Aggregations

Sum Aggregation

Add up all indexed numeric or date values in a field, optionally within a filtered subset.

Lexical Querying

Term, Terms, Prefix, Exists, and Match Queries

Use exact term lookups, field existence checks, prefix lookup, or analyzed text matching.

API Reference

TermPos

Recorded token position for one document occurrence.

API Reference

TermQuery

Exact term-level query against a single text field.

API Reference

TermQueryParams

Parameters for constructing a TermQuery.

Aggregations

Terms Aggregation

Build document-count facets from text fields over the full corpus or the current hit set.

API Reference

TermsQuery

Any-of exact term query against a single text field.

API Reference

TermsQueryParams

Parameters for constructing a TermsQuery.

Operations

Testing Search Behavior

Write tests around ranking, filtering, edge cases, and representative user queries instead of only API smoke tests.

API Reference

TextFieldIndex

Lexical field index with analyzers, ranking, phrase matching, prefix lookup, and aggregations.

API Reference

TextFieldIndexState

Serialized state for TextFieldIndex.

API Reference

TextFilter

Text preprocessor applied before tokenization.

Ranking

TF-IDF and BM25 Ranking

Choose between classic term weighting and Lucene-style BM25 scoring.

API Reference

TokenFilter

Token postprocessor applied after tokenization.

API Reference

Tokenizer

Tokenizer that turns raw text into token strings.

Indexing

Trie-Backed Prefix Expansion

Querylight keeps indexed text terms in a trie so prefix queries can expand to real terms already present in the field vocabulary.

API Reference

TrieNode

Mutable trie node used by SimpleStringTrie.

API Reference

TrieNodeState

Serialized trie node state.

Guides

Using Querylight TS as a Local Analytics Engine

How to use Querylight TS filtering and aggregation primitives for browser-side analytics over plain JSON records.

Aggregations

Value Count Aggregation

Count how many numeric or date values are indexed, optionally within the current result set.

API Reference

Vector

Dense numeric vector used for ANN indexing and reranking.

Other Features

Vector Rescoring for Faster Hybrid Search

Rescore only the top lexical candidates with vectors when full vector retrieval would be too broad or too slow.

API Reference

VectorFieldIndex

Locality-sensitive hash based vector index for approximate nearest-neighbor retrieval.

API Reference

VectorFieldIndexOptions

Tuning options for locality-sensitive hashing in VectorFieldIndex.

API Reference

VectorFieldIndexParams

Value-object constructor params for VectorFieldIndex.

API Reference

VectorFieldIndexState

Serialized state for VectorFieldIndex.

API Reference

VectorRescoreOptions

Tuning knobs for VectorRescoreQuery.

API Reference

VectorRescoreQuery

Hybrid query that reranks the top lexical window with vector similarity.

API Reference

VectorRescoreQueryParams

Parameters for constructing a VectorRescoreQuery.

API Reference

VectorScorer

Scores a query vector against one or more prepared candidate vectors.

Overview

What Querylight TS Can Do Beyond Full-Text Search

Querylight TS can power more than lexical retrieval, including faceting, aggregations, semantic retrieval, geo filtering, and lightweight dashboards.

Overview

What Querylight TS Covers

A compact browser and Node.js search toolkit for structured, explainable retrieval.

Overview

Why Local-First Data Exploration Helps API Prototyping

Explore raw API payloads locally before committing to a larger backend analytics architecture.

API Reference

WildcardQuery

Wildcard pattern query over indexed terms.

Lexical Querying

WildcardQuery for Term-Level Pattern Matching

Match indexed terms with `*` and `?` patterns without switching to full-text analysis.

API Reference

WildcardQueryParams

Parameters for constructing a WildcardQuery.