FAQs - smyrgl/LevelSearch GitHub Wiki

Here are some answers to a few general questions that people might have. If you feel like something needs to be addressed here but isn't feel free to suggest it!

Why should I use this? Why not just use NSFetchRequest and NSPredicate?

Excellent question! The reason is that Core Data does not perform any kind of full-text search indexing so using NSPredicate is going to be slow. If you are dealing with a small amount of data this might be ok but as your dataset increases search is going to get slower and slower to the point of it being a nuisance. When you are dealing with latency sensitive operations like auto-complete searching this is a real problem since you want to show your users results as quickly as possible.

Furthermore since Core Data is not designed for full-text search it does not perform any kind of tokenization of words for searching so you are going to get better results using LevelSearch.

Does this only work with Core Data? What if I want to index a document for searching?

For now this is Core Data only, the reasoning being that it makes this very simple to implement since LevelSearch can abstract away all the change management and just slot right into your normal Core Data flow. With document indexing it would require a more complex integration, however I am very much looking into this feature for LevelSearch and if there is enough demand I will absolutely find a way to do it that doesn't compromise the core principles of this library.