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:

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

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

Parameters

searchIndexer

The search indexer object performing the indexing.

managedObject

The managed object the indexer has just finished indexing.

Declared In

RKSearchIndexer.h

searchIndexer:didInsertSearchWord:forWord:inManagedObjectContext:

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

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

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:

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

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.

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.

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.

Declared In

RKSearchIndexer.h

searchIndexer:shouldIndexManagedObject:

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

Asks the delegate is a managed object should be indexed.

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:

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

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

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