Skip to content

Instantly share code, notes, and snippets.

@projectxcappe
Created October 28, 2011 18:38
Show Gist options
  • Save projectxcappe/1323022 to your computer and use it in GitHub Desktop.
Save projectxcappe/1323022 to your computer and use it in GitHub Desktop.
analytics...
- (void)_runSearchWithSearchString:(NSString *)searchString {
//10-28-2011 cass: omniture notification: "search called" event10
NSLog(@"search %@",searchString);
NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:searchString, @"query", nil];
[[NSNotificationCenter defaultCenter] postNotificationName:BCSearchNotification object:nil userInfo:userInfo];
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
if ([self _isWebServiceSearch]) {
self.searchString = searchString;
[self _runWebServiceSearch];
}
else {
NSMutableArray *tempArray = nil;
@synchronized([BCDatabaseController sharedController]) {
tempArray = [[BCDatabaseController sharedController] newsItemsForSearchString:searchString];
}
static NSSortDescriptor *sortDescriptor = nil;
if (!sortDescriptor)
sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"pubDate" ascending:NO selector:@selector(compare:)];
[tempArray sortUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]];
[self performSelectorOnMainThread:@selector(_handleNewsItemsLoaded:) withObject:[[tempArray copy] autorelease] waitUntilDone:NO];
}
[pool release];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment