{'heading': 'How Sanskrit and dosha pose search works in Ayurveda & Asana Yoga', 'summary': 'Every yoga posture in the app indexes its English `name`, `sanskrit` transliteration, and `AsanaFamily` into a diacritic-folded search index (`nameNormalized` and `searchTokens`). You can type plain English letters (such as `trikonasana`, `paschimottanasana`, or `virabhadrasana`) without macron accents, combine them with dosha filters (`Pacifies` / `Neutral` / `Aggravates`), and view duration-weighted Vata, Pitta, and Kapha scores on multi-pose sequences.', 'bullets': ['No diacritics required: The tokenizer folds accents (such as `ā`, `ś`, `ṣ`, `ṇ`) into standard ASCII letters automatically.', 'Partial root matching: Searching `konasana` (angle), `parivrtta` (revolved), or `supta` (reclining) surfaces matching postures across the 908-exercise catalog.', 'Dosha facet queries: `ExerciseAyurvedaSearch` strips generic words (`pose`, `asana`, `yoga`) and scores postures by Vata, Pitta, and Kapha preferences.', "Workout aggregation: Multi-pose sequences calculate their net dosha score weighted by each pose's `durationSeconds` (`weight = max(durationSeconds, 1)`)."]}
Every yoga posture in the app indexes its English `name`, `sanskrit` transliteration, and `AsanaFamily` into a diacritic-folded search index (`nameNormalized` and `searchTokens`). You can type plain English letters (such as `trikonasana`, `paschimottanasana`, or `virabhadrasana`) without macron accents, combine them with dosha filters (`Pacifies` / `Neutral` / `Aggravates`), and view duration-weighted Vata, Pitta, and Kapha scores on multi-pose sequences.
No diacritics required: The tokenizer folds accents (such as `ā`, `ś`, `ṣ`, `ṇ`) into standard ASCII letters automatically.
Partial root matching: Searching `konasana` (angle), `parivrtta` (revolved), or `supta` (reclining) surfaces matching postures across the 908-exercise catalog.
Dosha facet queries: `ExerciseAyurvedaSearch` strips generic words (`pose`, `asana`, `yoga`) and scores postures by Vata, Pitta, and Kapha preferences.
Workout aggregation: Multi-pose sequences calculate their net dosha score weighted by each pose's `durationSeconds` (`weight = max(durationSeconds, 1)`).
How the App Indexes Sanskrit Transliterations Without Diacritics
In scholarly Sanskrit transliteration (IAST), yoga posture names contain diacritical marks that distinguish long vowels and retroflex or palatal consonants—such as *Adho Mukha Śvānāsana* or *Paścimottānāsana*. Typing those characters on a mobile keyboard during practice is impractical, so `ExerciseItem.refreshSearchMetadata()` combines each posture's English `name`, `sanskrit` string, and `family.rawValue` and runs `.folding(options: .diacriticInsensitive, locale: .current)` in lowercase.
The tokenizer (`ExerciseItem.makeTokens` and `SmartExerciseSearch`) also splits hyphenated and compound phrases into unigrams, two-word bigrams, and three-word trigrams while dropping filler stopwords. That means you can type `adho mukha`, `svanasana`, `downward dog`, or `standing` into the search bar and immediately match the same catalog record without worrying about hyphens or accent marks.
- Search by Sanskrit root word: Try `baddha` (bound), `ardha` (half), `utthita` (extended), `parivrtta` (revolved), `salamba` (supported), or `viparita` (inverted).
- Search by English or Sanskrit interchangeably: Every pose card displays both the English title and the italicized `sanskrit` name underneath.
- Pose metadata on every card: Opening an `ExerciseItem` shows `family` (`AsanaFamily`), `level`, `breath` (`YogaBreath`), `drishti` (`YogaDrishti`), `muscleGroups`, and `contraindications`.
Combining Lexical Search with Ayurvedic Dosha Filters
When you want to find postures that also align with a Vata, Pitta, or Kapha goal—such as cooling seated folds or grounding standing postures—`ExerciseAyurvedaSearch` coordinates text search with Ayurvedic facet scoring. If you type a query like `seated asana pacifies pitta` or activate the dosha filter chips (`AyurvedaSearchFilters`), `CanonicalFacetParser` extracts the dosha constraint and strips generic words (`asana`, `asanas`, `exercise`, `exercises`, `pose`, `poses`, `yoga`) from the lexical search so they do not dilute your keyword match.
Each posture with a `YogaDosha` rating (`vata`, `pitta`, `kapha` on an integer `-2...2` scale, where negative numbers pacify/reduce a dosha and positive numbers increase/aggravate it) is then scored against your selected preference: a posture that pacifies the target dosha (`value < 0`) receives a `+120 + abs(value) * 10` boost, neutral (`0`) receives `+15` (or `+130` when specifically filtering for `.neutral`), and an opposite-direction posture receives `-120`.
- Pacifies (`< 0`): Ranks postures that calm or reduce the selected dosha at the top of the results.
- Neutral (`0`): Surfaces gentle, tridoshic postures that do not strongly push the selected dosha up or down.
- Unrated exercises: General fitness movements without a `resolvedYogaDosha` receive a `-30` sort penalty whenever an Ayurvedic filter is active so verified yoga postures appear first.
How Multi-Pose Workouts Calculate Duration-Weighted Dosha Effects
In addition to 908 individual exercises, the bundled catalog includes 4,419 structured `yogaSequences` and multi-pose workouts (`isWorkout == true`). A sequence that starts with two minutes of brisk Sun Salutations and then spends twenty minutes in supported restorative postures should not be judged by a simple unweighted average of pose counts.
When an `ExerciseItem` is a multi-pose workout without a static override, its `resolvedYogaDosha` property calls `YogaWorkoutAyurvedaMath.aggregate`. This function weights each linked posture's Vata, Pitta, and Kapha score by its actual hold time in seconds (`weight = max(durationSeconds, 1)`), divides by total sequence duration, and clamps the rounded result to `-2...2`. As a result, longer restorative holds or cooling closing postures accurately shape the sequence's overall dosha badge.
- Duration-weighted math: A 180-second supported forward fold carries six times the dosha weight of a 30-second standing transition.
- Clamped `-2` to `+2` scale: Matches the exact five-point scale used across food and daily Ayurveda summaries.
- Offline speed: All 908 exercises, 4,419 sequences, and 599,085 search vocabulary entries live in the local preseeded SwiftData catalog for instant offline search.
Frequently Asked Questions
Do I need to install a Sanskrit keyboard to search for poses in the app?
No. The app folds all Sanskrit diacritics into standard English letters during indexing, so typing `sirsasana`, `sarvangasana`, or `bhujangasana` on a standard keyboard works automatically.
Why does adding the word "pose" or "asana" to a dosha search not narrow the results?
`ExerciseAyurvedaSearch.parse` intentionally strips generic terms (`asana`, `asanas`, `pose`, `poses`, `yoga`, `exercise`, `exercises`) when dosha constraints are present so every posture in the library can be evaluated by the dosha filter.
How does the app calculate the dosha effect of a custom workout I edit?
Whenever a workout contains linked postures (`ExerciseLink`), `YogaWorkoutAyurvedaMath.aggregate` recalculates the Vata, Pitta, and Kapha values dynamically using each pose's `durationSeconds`.





