Skip to main content
Jasonisnthappy includes a built-in full-text search engine that uses TF-IDF (Term Frequency-Inverse Document Frequency) scoring to rank search results by relevance.

Overview

Full-text search allows you to:
  • Search across multiple text fields
  • Rank results by relevance score
  • Handle Unicode text correctly
  • Filter common words automatically
  • Scale to large document collections
Text search requires a text index to be created first. Regular indexes don’t support full-text search.

Creating a text index

Single field index

Create a text index on one field.

Multi-field index

Search across multiple fields simultaneously.
Include all fields you want to search in a single text index. Multiple text indexes on the same collection are supported but each search uses only one index.

Searching

Search for documents and get results sorted by relevance.

Understanding relevance scores

Scores represent how well a document matches the query:
  • Higher scores = more relevant
  • Scores are based on TF-IDF algorithm
  • Documents are automatically sorted by score (highest first)

How it works

Tokenization

Text is broken into tokens (words) using Unicode-aware word boundaries.
Features:
  • Case-insensitive (converted to lowercase)
  • Unicode word boundaries
  • Filters single-character tokens
  • Preserves contractions (“let’s”, “don’t”)

TF-IDF scoring

Relevance is calculated using Term Frequency-Inverse Document Frequency:

Advanced usage

Multi-word queries

Search for multiple terms - documents matching more terms score higher.

Search and filter

Combine full-text search with regular queries.
Currently, you cannot combine search with query filters in a single operation. Fetch results and filter in your application.

Paginating search results

Real-world examples

Performance optimization

Index creation

Create indexes on existing data:Text indexes are built from existing documents when created. For large collections, this can take time.

Search performance

Search is fast, even on large collections:
  • Uses B-tree for O(log n) term lookup
  • Ranks results in memory (fast for < 10,000 results)
  • Consider caching search results for common queries

Memory usage

Text indexes store:
  • Tokenized terms (lowercase)
  • Document IDs containing each term
  • Term frequencies
For very large collections with many unique terms, indexes can be substantial.

Limitations

Current limitations:
  • No phrase search (“exact phrase” matching)
  • No wildcard search (“rust*”, “*base”)
  • No fuzzy matching (typo tolerance)
  • No stop word removal (common words like “the”, “is”)
  • All terms are AND’ed (documents must contain at least one term)

Best practices

Index the fields you search:
Keep indexed text fields focused:
Use descriptive index names:

Tokenization details

What gets indexed

Edge cases

Comparison with regular indexes

Use both types together:
  • Text index for search
  • Regular index for exact lookups (ID, email, etc.)

Next steps

Indexes

Create regular indexes for exact matches

Querying

Filter search results with queries

Performance

Optimize search performance

CRUD operations

Insert searchable documents