Content Provider with Fast Text Search
Content providers manage access to a structured set of data. They encapsulate the data, and provide mechanisms for defining data security.Android Developers
ClassyFy sample application demonstrates a ContentProvider which provides
custom search suggestions
that are created from the ClassyFy application data. The suggestions are produced by a fast text search query engine from the
classyandroid project. The UML diagram on the right shows the classes which make the ClassyFy ContentProvider implementation.
Here is a summary of what these classes contribute to this implementation:
-
ClassyFyProvider
Extends android.content.ContentProvider and delegates everything to ClassySearchEngine. Note a ContentProvider may be initialized before onCreate() is called on the Application object specified in AndroidManifest.xml. Hence there is a defensive measure to delay initialization of the ContentProvider implementation. -
ClassySearchEngine
Implements classyandroid abstract class SearchEngineBase. The overriden method void onCreate(SQLiteOpenHelper sqLiteOpenHelper) initiates the FTS Engine startup and provides the persistence unit SQLiteOpenHelper shared by both itself and the FTS Engine. -
SearchEngineBase
Delegate for all queries, including search suggestions. A convention for UriMatcher IDs is applied to distinguish between Search Suggestion Uris and others. -
FtsEngine
Fast Text Search database and query support. It is customizable with regards to column mapping, sorting and filtering of text.

