@sargonpiraev

Search database

#database

A search database is optimized for finding documents by text, filters, and relevance.

The core idea is an inverted index. Instead of scanning every document, the database keeps a structure that maps terms to the documents that contain them.

Example

For documents:

1: "database indexes and query planning"
2: "search relevance and ranking"

An inverted index can map:

database -> [1]
query -> [1]
search -> [2]
ranking -> [2]

What it is good for

Search databases are useful for:

  • full-text search,
  • autocomplete,
  • filtering,
  • faceted navigation,
  • relevance ranking,
  • log search.

Tradeoff

Search databases are excellent at retrieval and ranking, but they are usually not the source of truth for transactional data. They often sit next to a relational database and receive indexed copies of records.

Elasticsearch is a common search database.