- (void)searchBar:(UISearchBar *)theSearchBar textDidChange:(NSString *)searchText {
//Remove all objects first.
[copyListOfItems removeAllObjects];
if([searchText length] > 0) {
[ovController.view removeFromSuperview];
searching = YES;
letUserSelectRow = YES;
self.tableView.scrollEnabled = YES;
[self searchTableView];
}
else {
[self.tableView insertSubview:ovController.view aboveSubview:self.parentViewController.view];
searching = NO;
letUserSelectRow = NO;
self.tableView.scrollEnabled = NO;
}
[self.tableView reloadData];
}
- (void) searchTableView {
NSString *searchText = searchBar.text;
NSMutableArray *searchArray = [[NSMutableArray alloc] init];
for (NSDictionary *dictionary in listOfItems)
{
NSArray *array = [dictionary objectForKey:@"key_pdescription"];
[searchArray addObjectsFromArray:array];
}
//in requirement searchArray has more than 50k objects
for (NSString *sTemp in searchArray)
{
NSRange titleResultsRange = [sTemp rangeOfString:searchText options:NSCaseInsensitiveSearch];
if (titleResultsRange.length > 0)
[copyListOfItems addObject:sTemp];
}
[searchArray release];
searchArray = nil;
}
, 즉 검색 그것은 기록의 수백 잘 작동,하지만 난 그 50 개 수천 이상 구현해야
입니다 을 1 문자를 입력 한 후 매우 느립니다. 다음 문자를 입력 할 때까지 기다려야합니다. 누군가가 모바일 로컬 검색을 위해 최적화 된 알고리즘을 구현 한 경우 진행 방법을 안내해주세요.
이 링크를 통해서도 이동하십시오. http://stackoverflow.com/questions/3067543/core-data-and-paging – User97693321