Rename primaryManagedObjectContext to persistentStoreManagedObjectContext since nobody can keep its role straight

This commit is contained in:
Blake Watters
2012-09-30 22:47:26 -04:00
parent 5cae20aabc
commit c10321751c
21 changed files with 364 additions and 352 deletions

View File

@@ -23,11 +23,11 @@ Indexing is configured through the managed object store and **must** be done bef
// Create the managed object contexts and start indexing
[managedObjectStore createManagedObjectContexts];
[managedObjectStore startIndexingPrimaryManagedObjectContext];
[managedObjectStore startIndexingPersistentStoreManagedObjectContext];
```
Once indexing is configured, an instance of `RKSearchIndexer` will observe the primary managed object context for save notifications. On save, any managed objects whose entities were configured for indexing will have their searchable attributes tokenized and stored as a to-many relationship to the `RKSearchWordEntity` entity.
Once indexing is configured, an instance of `RKSearchIndexer` will observe the persistent store managed object context for save notifications. On save, any managed objects whose entities were configured for indexing will have their searchable attributes tokenized and stored as a to-many relationship to the `RKSearchWordEntity` entity.
### Performing a Search
@@ -90,4 +90,4 @@ The search support is designed to be very easy to configure and use by snapping
- **Configure an Entity for Search**: `- (void)addSearchIndexingToEntityForName:(NSString *)entityName onAttributes:(NSArray *)attributes` - Adds search indexing to the entity with the given name in the receiver's managed object model for the given set of searchable string attributes.
- **Accessing the Search Indexer**: `@property (nonatomic, readonly) RKSearchIndexer *searchIndexer` Once indexing is configured for an entity, the `searchIndexer` property becomes available for use.
- **Managing Automatic Indexing**: `- (void)startIndexingPrimaryManagedObjectContext` and `- (void)stopIndexingPrimaryManagedObjectContext`. These methods provide quick control over automatic indexing of the primary managed object context on save.
- **Managing Automatic Indexing**: `- (void)startIndexingPersistentStoreManagedObjectContext` and `- (void)stopIndexingPersistentStoreManagedObjectContext`. These methods provide quick control over automatic indexing of the persistent store managed object context on save.

View File

@@ -58,27 +58,27 @@
///------------------------------------------
/**
Tells the search indexer to begin observing the primary managed object context for changes to searchable entities and updating the search words.
Tells the search indexer to begin observing the persistent store managed object context for changes to searchable entities and updating the search words.
This is a convenience method that is equivalent to the following example code:
RKSearchIndexer *searchIndexer = managedObjectStore.searchIndexer;
[searchIndexer startObservingManagedObjectContext:managedObjectStore.primaryManagedObjectContext];
[searchIndexer startObservingManagedObjectContext:managedObjectStore.persistentStoreManagedObjectContext];
@see `RKSearchIndexer`
*/
- (void)startIndexingPrimaryManagedObjectContext;
- (void)startIndexingPersistentStoreManagedObjectContext;
/**
Tells the search indexer to stop observing the primary managed object context for changes to searchable entities.
Tells the search indexer to stop observing the persistent store managed object context for changes to searchable entities.
This is a convenience method that is equivalent to the following example code:
RKSearchIndexer *searchIndexer = managedObjectStore.searchIndexer;
[searchIndexer stopObservingManagedObjectContext:managedObjectStore.primaryManagedObjectContext];
[searchIndexer stopObservingManagedObjectContext:managedObjectStore.persistentStoreManagedObjectContext];
@see `RKSearchIndexer`
*/
- (void)stopIndexingPrimaryManagedObjectContext;
- (void)stopIndexingPersistentStoreManagedObjectContext;
@end

View File

@@ -5,6 +5,18 @@
// Created by Blake Watters on 7/27/12.
// Copyright (c) 2012 RestKit. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#import <objc/runtime.h>
#import "RKManagedObjectStore+RKSearchAdditions.h"
@@ -43,14 +55,14 @@ static char searchIndexerAssociationKey;
[RKSearchIndexer addSearchIndexingToEntity:entity onAttributes:attributes];
}
- (void)startIndexingPrimaryManagedObjectContext
- (void)startIndexingPersistentStoreManagedObjectContext
{
[self.searchIndexer startObservingManagedObjectContext:self.primaryManagedObjectContext];
[self.searchIndexer startObservingManagedObjectContext:self.persistentStoreManagedObjectContext];
}
- (void)stopIndexingPrimaryManagedObjectContext
- (void)stopIndexingPersistentStoreManagedObjectContext
{
[self.searchIndexer stopObservingManagedObjectContext:self.primaryManagedObjectContext];
[self.searchIndexer stopObservingManagedObjectContext:self.persistentStoreManagedObjectContext];
}
@end