I have successfully (sort of) implemented spotlight indexing in my iPhone app but certain search strings do not seem to be able to be searched.
I create each CSSearchableItemAttributeSet as type kUTTypeText, I set the display name, title as "D0010". I also set the keywords to include "D0010" as well. (there are a few hundred with an incrementing number e.g. D0011, D0012 ...)
The app completed the indexing without error.
When I goto the spotlight search and type "D0" I get three or so results back, as i continue to type "D001" i get no results.
Funny thing is if I type "0010" i get the exact result!
Has anyone any idea whats going on?
Partial Objective C code below.
attributeSet.displayName = [[NSString alloc] initWithFormat:@"%@", [dataflow flowCounter]];
attributeSet.title = [[NSString alloc] initWithFormat:@"%@", [dataflow flowCounter]];
//Sounds similar to displayName but is not displayed to user
attributeSet.contentDescription = [[NSString alloc] initWithFormat:@"%@", [dataflow flowDescription]];
attributeSet.keywords = @[[[NSString alloc] initWithFormat:@"%@", [dataflow flowCounter]],[[NSString alloc] initWithFormat:@"D%@", [dataflow flowNumber]],[dataflow flowCounter], attributeSet.displayName, attributeSet.contentDescription,[dataflow flowNumber],[dataflow flowCounter] ];
CSSearchableItem *item1 = [[CSSearchableItem alloc] initWithUniqueIdentifier:[[NSString alloc] initWithFormat:@"DTC_%@", [dataflow flowNumber]] domainIdentifier:@"com.utiligroup" attributeSet:attributeSet];
........
[[CSSearchableIndex defaultSearchableIndex] indexSearchableItems:[self.spotlightsearch copy]
completionHandler: ^(NSError * __nullable error) {
if (error != nil ){
NSLog(@"Error");
}
else {
NSLog(@"dataflows added ");