FTS3Pattern

A full text pattern that can query FTS3 and FTS4 virtual tables.

  • The raw pattern string. Guaranteed to be a valid FTS3/4 pattern.

  • Creates a pattern from a raw pattern string; throws DatabaseError on invalid syntax.

    The pattern syntax is documented at https://www.sqlite.org/fts3.html#full_text_index_queries

    try FTS3Pattern(rawPattern: "and") // OK
    try FTS3Pattern(rawPattern: "AND") // malformed MATCH expression: [AND]
    
  • Creates a pattern that matches any token found in the input string; returns nil if no pattern could be built.

    FTS3Pattern(matchingAnyTokenIn: "")        // nil
    FTS3Pattern(matchingAnyTokenIn: "foo bar") // foo OR bar
    
  • Creates a pattern that matches all tokens found in the input string; returns nil if no pattern could be built.

    FTS3Pattern(matchingAllTokensIn: "")        // nil
    FTS3Pattern(matchingAllTokensIn: "foo bar") // foo bar
    
  • Creates a pattern that matches all token prefixes found in the input string; returns nil if no pattern could be built.

    FTS3Pattern(matchingAllTokensIn: "")        // nil
    FTS3Pattern(matchingAllTokensIn: "foo bar") // foo* bar*
    
  • Creates a pattern that matches a contiguous string; returns nil if no pattern could be built.

    FTS3Pattern(matchingPhrase: "")        // nil
    FTS3Pattern(matchingPhrase: "foo bar") // "foo bar"
    
  • Returns a value that can be stored in the database.

  • Returns an FTS3Pattern initialized from dbValue, if it contains a suitable value.