Guest User

Untitled

a guest
Aug 18th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. - (void)_runSearchWithSearchString:(NSString *)searchString {
  2.  
  3. //10-28-2011 cass: omniture notification: "search called" event10
  4. NSLog(@"search %@",searchString);
  5. NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:searchString, @"query", nil];
  6. [[NSNotificationCenter defaultCenter] postNotificationName:BCSearchNotification object:nil userInfo:userInfo];
  7.  
  8. NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  9. if ([self _isWebServiceSearch]) {
  10. self.searchString = searchString;
  11. [self _runWebServiceSearch];
  12. }
  13. else {
  14. NSMutableArray *tempArray = nil;
  15. @synchronized([BCDatabaseController sharedController]) {
  16. tempArray = [[BCDatabaseController sharedController] newsItemsForSearchString:searchString];
  17. }
  18. static NSSortDescriptor *sortDescriptor = nil;
  19. if (!sortDescriptor)
  20. sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"pubDate" ascending:NO selector:@selector(compare:)];
  21. [tempArray sortUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]];
  22. [self performSelectorOnMainThread:@selector(_handleNewsItemsLoaded:) withObject:[[tempArray copy] autorelease] waitUntilDone:NO];
  23. }
  24. [pool release];
  25.  
  26. }
Add Comment
Please, Sign In to add comment