trigram search

String metric algorithm

Uses your system voice; voice and rate in settings.

Q7841902Snapshot

≈ 2 min read

Names in other languages

  • فارسیپیش‌نویس:جستجوی Trigram
  • Englishtrigram search

Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.

Trigram search is a method of searching for text when the exact syntax or spelling of the target object is not precisely known or when queries may be regular expressions. It finds objects which have the most matches against three-character substrings (i.e. trigrams) of the search terms, which are generally near matches.

Two strings with many shared trigrams can be expected to be very similar. Trigrams also allow for efficiently creating search engine indexes for searches that are regular expressions or match the text inexactly. Indexes can significantly accelerate searches.

A threshold for number of trigram matches can be specified as a cutoff point, after a result is unmatched. Using trigrams for accelerating searches is a technique used in some systems for code searching, in situations in which queries that are regular expressions may be useful, in search engines such as Elasticsearch, as well as in databases such as PostgreSQL.

See also

Approximate string matching Google Code Search N-gram

Text derived from https://en.wikipedia.org/w/index.php?oldid=1354997049 under CC BY-SA 4.0; modifications have been made.

Provenance

snapshot trigram-search-882091-fc94543c029b4286 · hash fc94543c029b428628b24a69f7dbad545f59de78e82f69dacf402138325d484e · captured 2026-05-19 · not yet sealed in the ledger · verify the chain · version history

Cite this page as: encyclopegia.org, “trigram search”, snapshot trigram-search-882091-fc94543c029b4286. https://encyclopegia.org/a/trigram-search

Sources cited in this revision

No external citation was extracted for this revision. That is a statement about the source, not a claim that none exists.