SearchTerm

open class SearchTerm : SearchExpression

Represents an OData search term (word or phrase).

  • An empty search term, that will match any words.

    Declaration

    Swift

    nonisolated(unsafe) public static let empty: SearchTerm
  • Search operator, or zero if isTerm is true.

    Declaration

    Swift

    override open var `operator`: Int { get }
  • See also

    word if the server doesn’t support adding “*” beforehand and afterwards to enable “contains” matching.

    Declaration

    Swift

    open class func contains(_ text: String) -> SearchTerm

    Parameters

    text

    Text of word(s), or phrase surrounded by double quotes.

    Return Value

    a new word or phrase term with “*” before and after each word to indicate “contains” matching. Note: some server implementations might not support such “contains” matching. Use only where appropriate.

  • Is this search term empty, so it will match any words?

    Declaration

    Swift

    override open var isEmpty: Bool { get }
  • True if this search expression is a SearchTerm where SearchTerm.isPhrase is true.

    Declaration

    Swift

    override open var isPhrase: Bool { get }
  • True if this search expression is a SearchTerm.

    Declaration

    Swift

    override open var isTerm: Bool { get }
  • True if this search expression is a SearchTerm where SearchTerm.isWord is true.

    Declaration

    Swift

    override open var isWord: Bool { get }
  • Declaration

    Swift

    override open func matchesWithOptions(words: StringList, options: SearchOptions) -> Bool

    Parameters

    words

    Words to be matched with this search expression.

    options

    Search options.

    Return Value

    True if this search expression matches a specified list of words.

  • Search operands (immutable list), or empty if isTerm is true.

    Declaration

    Swift

    override open var operands: SearchExpressionList { get }
  • Declaration

    Swift

    open class func phrase(_ words: StringList) -> SearchTerm

    Parameters

    words

    Phrase words.

    Return Value

    a new phrase term. For a phrase term, matches ensures that the words of the phrase occur in sequence.

  • See also

    word if the server doesn’t support adding “*” afterwards to enable prefix matching.

    Declaration

    Swift

    open class func prefix(_ text: String, limit: Int = (0 as Int)) -> SearchTerm

    Parameters

    text

    Text of word(s), or phrase surrounded by double quotes.

    limit

    Number of words to have “*” afterwards. If zero, it applies to all words. If positive, it applies to the first limit words. If negative, it applies to the last -limit words.

    Return Value

    a new word or phrase term with “*” after each word to indicate prefix matching. Note: some server implementations might not support such prefix matching. Use only where appropriate.

  • See also

    word if the server doesn’t support adding “*” beforehand to enable suffix matching.

    Declaration

    Swift

    open class func suffix(_ text: String, limit: Int = (0 as Int)) -> SearchTerm

    Parameters

    text

    Text of word(s), or phrase surrounded by double quotes.

    limit

    Number of words to have “*” afterwards. If zero, it applies to all words. If positive, it applies to the first limit words. If negative, it applies to the last -limit words.

    Return Value

    a new word or phrase term with “*” before each word to indicate suffix matching. Note: some server implementations might not support such suffix matching. Use only where appropriate.

  • Declaration

    Swift

    override open func toString() -> String

    Return Value

    This search expression in human readable format.

  • Declaration

    Swift

    override open func urlString() -> String

    Return Value

    This search expression in OData URL format.

  • Declaration

    Swift

    open class func word(_ text: String) -> SearchTerm

    Parameters

    text

    Word text.

    Return Value

    a new word term.

  • Search words, or empty if isTerm is false.

    Declaration

    Swift

    override open var words: StringList { get }