Added back predicateForSearchWithText:searchMode: and added documentation

This commit is contained in:
Jawwad Ahmad
2012-03-14 19:30:03 -04:00
parent b48e69a3ba
commit 0c16af2889
2 changed files with 25 additions and 0 deletions

View File

@@ -53,6 +53,20 @@
*/
+ (NSArray *)searchableAttributes;
///-----------------------------------------------------------------------------
/// @name Obtaining a Search Predicate
///-----------------------------------------------------------------------------
/**
A predicate that will search for the specified text with the specified mode. Mode can be
configured to be RKSearchModeAnd or RKSearchModeOr.
@return A predicate that will search for the specified text with the specified mode.
@see RKSearchMode
*/
+ (NSPredicate *)predicateForSearchWithText:(NSString *)searchText searchMode:(RKSearchMode)mode;
///-----------------------------------------------------------------------------
/// @name Managing the Search Words
///-----------------------------------------------------------------------------

View File

@@ -35,6 +35,17 @@
return [NSArray array];
}
+ (NSPredicate *)predicateForSearchWithText:(NSString *)searchText searchMode:(RKSearchMode)mode
{
if (searchText == nil) {
return nil;
} else {
RKManagedObjectSearchEngine *searchEngine = [RKManagedObjectSearchEngine searchEngine];
searchEngine.mode = mode;
return [searchEngine predicateForSearch:searchText];
}
}
- (void)refreshSearchWords
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];