so after reviewing apple's TableSearch sample code, i was a little surprised with how weak the search is. the table lists apple products, "Powerbook, iPod touch, iPhone", etc., but the search results are only returned based on the first letter of the item. so if you search for "phone" or "touch", you receive no results, while "iph" will return "iPhone" and "iPod t" will return "iPod Touch. ghetto that!
i assumed the cause was because NSLiteralSearch was missing from the code, but none of the search and comparison constants seem to help.
here is the offending sample code:
i just know i'm missing something obvious...
i assumed the cause was because NSLiteralSearch was missing from the code, but none of the search and comparison constants seem to help.
here is the offending sample code:
Code:
- (void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope
{
[self.filteredListContent removeAllObjects]; // First clear the filtered array.
for (Product *product in listContent)
{
if ([scope isEqualToString:@"All"] || [product.type isEqualToString:scope])
{
NSComparisonResult result = [product.name compare:searchText options:(NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch) range:NSMakeRange(0, [searchText length])];
if (result == NSOrderedSame)
{
[self.filteredListContent addObject:product];
}
}
}
}
i just know i'm missing something obvious...