Share via


FoundValue interface

Represents a value that was successfully found and matched during a search operation.

Example

// Example of a FoundValue result from searching for "red" in ["red", "green", "blue"]
const foundValue: FoundValue = {
  value: "red",
  index: 0,
  score: 1.0
};

Remarks

This interface contains the matched value along with metadata about the match quality and its position in the original search list.

Properties

index

The zero-based index position of this value in the original list that was searched.

Example

0 (if "red" was the first item in the original choices array)
score

A confidence score between 0 and 1 indicating the quality of the match.

Example

1.0 for exact matches, 0.8 for close partial matches, 0.3 for distant fuzzy matches
value

The exact value that was matched from the original search list.

Example

"red" (when user typed "rd" and it matched "red")

Property Details

index

The zero-based index position of this value in the original list that was searched.

Example

0 (if "red" was the first item in the original choices array)
index: number

Property Value

number

Remarks

This allows you to correlate the found value back to its position in the source array.

score

A confidence score between 0 and 1 indicating the quality of the match.

Example

1.0 for exact matches, 0.8 for close partial matches, 0.3 for distant fuzzy matches
score: number

Property Value

number

Remarks

  • 1.0 indicates a perfect exact match
  • Lower values indicate partial or fuzzy matches
  • Calculated based on completeness (how much of the value matched) and accuracy (token distance)

value

The exact value that was matched from the original search list.

Example

"red" (when user typed "rd" and it matched "red")
value: string

Property Value

string

Remarks

This is the original string value, not the user's input that matched it.