title: Optimising CoreData fulltext query
body: <p>I have a large collection of CoreData objects which represent files. Periodically, I need to search this collection and find files which exist at a given path. Currently, I'm constructing the following NSPredicate and performing a fairly basic executeFetchRequest to find all results which match my query.</p>
  
  <pre><code>NSPredicate *predicate = [NSPredicate predicateWithFormat:@"path ==[c] %@", receivedPath];
  
  NSEntityDescription *entity = [NSEntityDescription entityForName:@"Files" inManagedObjectContext:self.moc];
  NSFetchRequest *request = [[NSFetchRequest alloc] init];
  [request setEntity:entity];
  [request setPredicate:predicate];
  [request setFetchBatchSize:10];
  
  NSError *error = nil;
  NSArray *results = [self.moc executeFetchRequest:request error:&amp;error];
  [request release];
  </code></pre>
  
  <p>The issue I'm having is that this function is called fairly frequently and the executeFetchRequest is accounting for a significant percentage of execution time (Instruments tells me the function accounts for around 49.2% in total, with 98.1% of that total spent on the executeFetchRequest call). I'm using <code>NSSQLiteStoreType</code> for my persistent store and have the <code>path</code> attribute indexed in my MOM.</p>
  
  <p>My question is, how can I optimise this? I've considered setting up a lowercasePath attribute, and ditching the [c] modifier on the comparison, but am unsure as to what impact (if any) that would have on execution time. </p>
  
  <p>Any help would be greatly appreciated.</p>