FullTextSearch

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface YapDatabaseFullTextSearch : YapDatabaseExtension
    
    - (id)initWithColumnNames:(NSArray<NSString *> *)columnNames
                      handler:(YapDatabaseFullTextSearchHandler *)handler;
    
    - (id)initWithColumnNames:(NSArray<NSString *> *)columnNames
                        handler:(YapDatabaseFullTextSearchHandler *)handler
                   versionTag:(nullable NSString *)versionTag;
    
    - (id)initWithColumnNames:(NSArray<NSString *> *)columnNames
                      options:(nullable NSDictionary *)options
                      handler:(YapDatabaseFullTextSearchHandler *)handler
                   versionTag:(nullable NSString *)versionTag;
    
    - (id)initWithColumnNames:(NSArray<NSString *> *)columnNames
                      options:(nullable NSDictionary *)options
                      handler:(YapDatabaseFullTextSearchHandler *)handler
                   ftsVersion:(nullable NSString *)ftsVersion
                   versionTag:(nullable NSString *)versionTag;
    
    
    /* Inherited from YapDatabaseExtension
     
    @property (nonatomic, strong, readonly) NSString *registeredName;
     
    */
    
    @property (nonatomic, strong, readonly) YapDatabaseFullTextSearchHandler *handler;
    
    /**
     * The versionTag assists in making changes to the extension.
     *
     * If you need to change the columnNames and/or block,
     * then simply pass a different versionTag during the init method,
     * and the FTS extension will automatically update itself.
     */
    @property (nonatomic, copy, readonly, nullable) NSString *versionTag;
    @property (nonatomic, copy, readonly, nullable) NSString *ftsVersion;
    
    @end

    Swift

    class YapDatabaseFullTextSearch : YapDatabaseExtension
  • Welcome to YapDatabase!

    The project page has a wealth of documentation if you have any questions. https://github.com/yapstudios/YapDatabase

    If you’re new to the project you may want to check out the wiki https://github.com/yapstudios/YapDatabase/wiki

    YapDatabaseFullTextSearch is an extension for performing text based search. Internally it uses sqlite’s FTS module which was contributed by Google.

    After registering the extension, you can access this class within a regular transaction. For example:

    [databaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction){

     [[transaction ext:@"mySearch"] enumerateKeysMatching:@"birthday party"
                                               usingBlock:^(NSString *collection, NSString *key, BOOL *stop){
         // matching row...
     }]
    

    }];

    See more

    Declaration

    Objective-C

    @interface YapDatabaseFullTextSearchTransaction
        : YapDatabaseExtensionTransaction

    Swift

    class YapDatabaseFullTextSearchTransaction : YapDatabaseExtensionTransaction
  • The handler block handles extracting the column values for indexing by the FTS module.

    When you add or update rows in the databse the FTS block is invoked. Your block can inspect the row and determine if it contains any text columns that should be indexed. If not, the block can simply return. Otherwise the block should extract any text values, and add them to the given dictionary.

    After the block returns, the dictionary parameter will be inspected, and any set values will be automatically passed to sqlite’s FTS module for indexing.

    You should choose a block type that takes the minimum number of required parameters. The extension can make various optimizations based on the required parameters of the block.

    See more

    Declaration

    Objective-C

    @interface YapDatabaseFullTextSearchHandler : NSObject

    Swift

    class YapDatabaseFullTextSearchHandler : NSObject
  • This class represents options that may be passed to the FTS snippet function.

    It correlates with the snippet funtion arguments as defined in sqlite’s FTS module: http://www.sqlite.org/fts3.html#section_4_2

    For example, if you were searching for the word favorite, then a returned snippet may look something like this:

    one of my favorite cheese pairings is

    See more

    Declaration

    Objective-C

    @interface YapDatabaseFullTextSearchSnippetOptions : NSObject <NSCopying>

    Swift

    class YapDatabaseFullTextSearchSnippetOptions : NSObject, NSCopying