Query results
Shape of each hit returned by
Search().
interface GlyphQueryResult { key: string; similarity: number; comparison: GlyphComparisonResult; matched?: string | number;}Fields
Section titled “Fields”| Field | Type | Meaning |
|---|---|---|
key |
string |
Index key for this entry |
similarity |
number |
Score for ranking (0–1, or normalized) |
comparison |
GlyphComparisonResult |
Full compare output for this pair |
matched |
string | number |
Winning member key when the index value is a group |
matched
Section titled “matched”Present when the index entry is a group. It is the winning member on the index side (comparison.matchedRight).
| How the group was passed | Example matched |
|---|---|
Array [pasta, moon] (index 1 wins) |
1 (number) |
Map { noise: pasta, hit: moon } |
"hit" (string) |
Pure-digit map keys are coerced to numbers so array-style usage stays intuitive. Named keys stay strings.
comparison object
Section titled “comparison object”{ "similarity": 0.35, "matches": 45, "distance": 83, "size": 128, "matchedLeft": 0, "matchedRight": "hit"}Same fields as Compare. When normalize: true, comparison.similarity matches the result-level similarity after scaling.
Sort order
Section titled “Sort order”Results are sorted by similarity descending. Index iteration order does not affect rank.
Empty results
Section titled “Empty results”Search() returns [] when:
- The index has no keys, or
- Every entry is below
threshold
Example output
Section titled “Example output”[ { "key": "groups.md", "similarity": 1.0, "comparison": { "similarity": 1.0, "matches": 128, "distance": 0, "size": 128 } }, { "key": "article", "similarity": 0.67, "matched": "body", "comparison": { "similarity": 0.67, "matches": 86, "distance": 42, "size": 128, "matchedRight": "body" } }]