Enum SearchSimilarityAlgorithm
- Namespace
- MongoDB.EntityFrameworkCore.Metadata.Search
- Assembly
- MongoDB.EntityFrameworkCore.dll
Relevance scoring algorithms for MongoDB search string fields.
public enum SearchSimilarityAlgorithm
Fields
Bm25 = 0Okapi BM25 (default): probabilistic relevance model that balances term frequency (with saturation), inverse document frequency, and field-length normalization for robust ranking.
Boolean = 1Boolean model: ignores term frequency and length normalization; focuses on presence/absence of query terms for deterministic matching with minimal scoring variation.
StableTfl = 2Stable TF-L: stable term-frequency and length-based scoring designed to keep scores consistent across index updates and corpus changes, trading off nuanced BM25-style ranking. Useful when predictable, repeatable scores are preferred over aggressive relevance tuning.
Remarks
Similarity determines how MongoDB search computes the score of a document for a given query, typically based on term frequency, inverse document frequency, and field length. Choose an algorithm that matches your scoring needs (e.g., full relevance ranking vs. presence-only matching). For background, see Atlas Search string field options. https://www.mongodb.com/docs/atlas/atlas-search/field-types/string/