%iKnow.Matching.Formats.SimplePrefixFormat

class %iKnow.Matching.Formats.SimplePrefixFormat extends %iKnow.Matching.Formats.Format

This sample %iKnow.Matching.Formats.Format implementation checks whether a string starts with a given character sequence, offering a meaningful MatchAll() example.

Format parameters:

  1. prefix (%String, no default) - the prefix to check for, with no double, starting or trailing spaces
  2. outputType (%Integer, default 0) - what to supply in terms of output:
    • 0: no output
    • 1: the remainder of the word following the (first occurrence of the) prefix
    • 2: same as 1, but if there is a space following the prefix, returns the next word
    • 3: the whole entity starting right after the (first occurrence of the) prefix

Method Inventory

Methods

method HasMatchAll() as %Boolean [ Language = objectscript ]
method MatchAll(stringsGlobalName As %String, resultGlobalName As %String, formatParams As %List, minEntUniId As %Integer = 0) as %Status [ Language = objectscript ]
Inherited description:

This method loops through @stringsGlobalName@(" "_string) = id and matches all global entries, storing the results in @resultGlobalName@(id) = $lb(matchScore, matchedWordBits, isScattered, formatOutput). The implementation should ignore all ids < minEntUniId and should not store any results if the matchScore is 0.

Implementing this method only makes sense if the specific format this class represents can exploit the inverse global structure of @stringsGlobalName.

Note: entries in @stringsGlobalName are all in lowercase and prefixed with a space

Warning: an implementation for this method does not replace MatchSingle(). There should still be a MatchSingle alternative, for example to process strings longer than $$$IKHASHSIZE that would not appear in @stringsGlobalName.

method MatchSingle(string As %String, formatParams As %List, Output matchScore As %Numeric, Output matchedWordBits, Output isScattered As %Boolean, Output formatOutput) as %Status [ Language = objectscript ]
Inherited description:

Implementations of this method check whether an individual string complies with the format this class represents, returning a matchScore (0..1) and optional matchedWordBits, isScattered and formatOutput through output parameters.

Inherited Members

Inherited Properties

Inherited Methods

Feedback