Top Method Summary
Options Name Purpose
DECIMAL GetMatchScore (character, character) Scores how well pcCandidate matches pcSearchTerm
LOGICAL IsWordStart (character, integer) Returns if the character at position piPosition of pcCandidate starts a word - the first character, a character following a separator (space, -, _, /, ~\, .), an upper-case character following a lower-case one (camelCase boundary) or a letter/digit transition (e.g. the "2" in "Sports2000")
DECIMAL ScoreSubsequence (character, character) Scores the best alignment of pcSearchTerm as a character subsequence of pcCandidate

Top Constructor Summary
Options Name Purpose
FuzzyMatchHelper () Protected default constructor.


Method Detail
Top

DECIMAL GetMatchScore (character, character)

Purpose: Scores how well pcCandidate matches pcSearchTerm
Notes: Higher is a better match. An empty pcSearchTerm always
matches (score 1), so callers showing "no term typed yet"
results can call this unconditionally. Returns -1 when
pcCandidate does not match pcSearchTerm at all. The tiers
are: exact match (1000), candidate begins with the term
(500), candidate contains the term (200), and below that a
scored character-subsequence alignment (less than 150) that
rewards characters matched at word starts, contiguous runs
and exact-case hits, damped by the candidate length so the
shorter of two equally good candidates ranks first. All
tiers match case-insensitively - the character case only
influences the ranking, never whether a candidate matches

Parameters:
pcCandidate CHARACTER
The text to match against (e.g. a menu function title)
pcSearchTerm CHARACTER
The user entered search term
Returns DECIMAL
The match score, or -1 when there is no match
Top

LOGICAL IsWordStart (character, integer)

Purpose: Returns if the character at position piPosition of pcCandidate
starts a word - the first character, a character following a
separator (space, -, _, /, ~\, .), an upper-case character
following a lower-case one (camelCase boundary) or a
letter/digit transition (e.g. the "2" in "Sports2000")
Notes:

Parameters:
pcCandidate CHARACTER
The candidate text
piPosition INTEGER
The 1-based character position to test
Returns LOGICAL
Logical value indicating if the character starts a word
Top

DECIMAL ScoreSubsequence (character, character)

Purpose: Scores the best alignment of pcSearchTerm as a character
subsequence of pcCandidate
Notes: Dynamic programming over (term position, candidate position),
so of all possible alignments the highest scoring one wins -
e.g. "Cus" aligns with the word start of "Customer" rather
than with scattered characters of an earlier word. Each
matched character scores a base bonus plus bonuses for
matching at a word start, for extending a contiguous run and
for matching with the exact case. The total is normalized to
the maximum achievable bonus for the term and damped by the
candidate length, keeping the result below the substring tier
of GetMatchScore and ranking the shorter of two equally good
candidates first
pcSearchTerm is not a subsequence of pcCandidate

Parameters:
pcCandidate CHARACTER
The text to match against
pcSearchTerm CHARACTER
The user entered search term
Returns DECIMAL
The alignment score (greater than 0, less than 150), or -1 when


Constructor Detail
Top

FuzzyMatchHelper ()

Purpose: Protected default constructor.
Notes: There's no need to create instances of this helper class



©2006-2026 Consultingwerk Ltd.         info@consultingwerk.de         http://www.consultingwerk.de       19.09.2026 10:19:30