Conforms to NSObject
Declared in RKSearchIndexer.h

Overview

Objects that acts as the delegate for a RKSearchIndexer object must adopt the RKSearchIndexerDelegate protocol. The delegate may customize the behavior of the search indexer to match the needs of the application in several ways. The delegate may provide an alternate implementation for fetching an existing RKSearchWord managed object for a given word, it is consulted when the indexer determines that a new search word object is to be inserted and may decline the insertion, and it is notified after a new search word has been inserted.

Tasks

Fetching Existing Search Words

Tracking Indexing of Managed Objects

Tracking Insertion of Search Words

Instance Methods

searchIndexer:didIndexManagedObject:

Tells the delegate that the indexer has finished indexing a managed object.

- (void)searchIndexer:(RKSearchIndexer *)searchIndxer didIndexManagedObject:(NSManagedObject *)managedObject

Parameters

managedObject

The managed object the indexer has just finished indexing.

searchIndexer

The search indexer object performing the indexing.

Declared In

RKSearchIndexer.h

searchIndexer:didInsertSearchWord:forWord:inManagedObjectContext:

Tells the delegate that the indexer has inserted a new search word object for a word.

- (void)searchIndexer:(RKSearchIndexer *)searchIndexer didInsertSearchWord:(RKSearchWord *)searchWord forWord:(NSString *)word inManagedObjectContext:(NSManagedObjectContext *)managedObjectContext

Parameters

searchIndexer

The search indexer object performing the indexing.

searchWord

The search word that was inserted.

word

The word for which the search word object was created.

managedObjectContext

The managed object context in which indexing is taking place.

Declared In

RKSearchIndexer.h

searchIndexer:searchWordForWord:inManagedObjectContext:error:

Asks the delegate for an existing search word object for a given word in the managed object context being indexed. If no search word is found for the given word, then nil is to be returned.

- (RKSearchWord *)searchIndexer:(RKSearchIndexer *)searchIndexer searchWordForWord:(NSString *)word inManagedObjectContext:(NSManagedObjectContext *)managedObjectContext error:(NSError **)error

Parameters

searchIndexer

The search indexer object performing the indexing.

word

The search word for which to retrieve an existing

managedObjectContext

The managed object context in which indexing is taking place.

error

A pointer to an error object to be set in the event an error occurs.

Return Value

The RKSearchWord object corresponding to the given word, or nil if none could be found. In the event an error occurs, nil is to be returned and the value of the error property is to be set to a pointer to an NSError object describing the failure.

Discussion

By default, the search indexer creates and executes a fetch request against the context being indexed for each word during indexing. For large data-sets, this can wind up taking a significant amount of time. By providing an implementation of searchIndexer:searchWordForWord:inManagedObjectContext:error:, the delegate can be used to implement a caching scheme to reduce the overhead associated with the execution of these fetch requests.

Declared In

RKSearchIndexer.h

searchIndexer:shouldIndexManagedObject:

Asks the delegate is a managed object should be indexed.

- (BOOL)searchIndexer:(RKSearchIndexer *)searchIndexer shouldIndexManagedObject:(NSManagedObject *)managedObject

Parameters

searchIndexer

The search indexer object performing the indexing.

managedObject

The managed object the indexer is preparing to index.

Return Value

YES if indexing should proceed, else NO.

Declared In

RKSearchIndexer.h

searchIndexer:shouldInsertSearchWordForWord:inManagedObjectContext:

Asks the delegate if the indexer should insert a new search word for a word that does not currently exist in the index.

- (BOOL)searchIndexer:(RKSearchIndexer *)searchIndexer shouldInsertSearchWordForWord:(NSString *)word inManagedObjectContext:(NSManagedObjectContext *)managedObjectContext

Parameters

searchIndexer

The search indexer object performing the indexing.

word

A search word that appears in an indexed object but does not yet exist in the index.

managedObjectContext

The managed object context in which indexing is taking place.

Return Value

YES if the indexer should insert an RKSearchWord object for the given word, else NO.

Declared In

RKSearchIndexer.h