Full-text Search
Tigris integrates database, search engine, and sync mechanism in a single, unified platform providing the fastest and easiest way to build search capabilities into applications.
With Tigris, there is no need to stand up and manage a sync mechanism, write custom transformation logic, or remap search indexes as your database evolves.
Features
Tigris search provides the following rich set of features:
Usage
There are two ways to use search in Tigris:
- Database + Search: Automatically synchronize some or all of the data in a database collection to a search index that is automatically created and maintained by Tigris.
- Standalone Search: Use search without a database for use cases where you need to provide search capabilities for data that is not stored in a Tigris database.
Database + Search
Tigris automatically creates a search index and synchronizes data from a
database collection. All you have to do is mark fields in your schema as searchable.
Below is an example of a data model for the products
collection that has
searchable fields name
, description
, and tags
:
@TigrisCollection("products")
export class Product {
@PrimaryKey({ order: 1, autogenerate: true })
id?: number;
@SearchField({ sort: true })
@PrimaryKey({ order: 2 })
name: string;
@Field({ default: 1 })
quantity: number;
@SearchField()
@Field({ maxLength: 128, default: "" })
description: string;
@SearchField({ elements: TigrisDataTypes.STRING, facet: true })
@Field({ elements: TigrisDataTypes.STRING })
tags: Array<string>;
}
You can then use the search API to search for documents in the collection.
Standalone Search
Tigris provides a standalone search API that can be used to index and search data that is not stored in a Tigris database.
To use standalone search, you need to create a search model describing the index
@TigrisSearchIndex("catalog")
export class Catalog {
@SearchField({ sort: true })
name: string;
@SearchField({ sort: true })
price: number;
@SearchField({ facet: true })
brand: string;
@SearchField({ elements: TigrisDataTypes.STRING, facet: true })
@Field({ elements: TigrisDataTypes.STRING })
tags: Array<string>;
}
You can then use the create API to index documents in the search index and the search API to search for documents in the collection.
Further reading
Checkout the language-specific reference sections to learn more about using search in your favorite language.