Lucene full-text search Framework for Android offers a rapid way to integrate and manage full text search in Android by using the best open source full-featured text search engine library – Lucene.
How does it work?
User selects a list of folders to index and schedule indexing (or uses default 00:30). When indexing occurs, application checks if any of the indexed files were removed from disk or updated, if any folders were removed from indexed folders list then removes associated indexed files from Lucene index, takes every folder selected for indexing and recursively process every subfolder and file in it. Files are processed by extracting text content and adding it to Lucene index. All info about indexed files and folders are kept in two tables in database.
Remember that while choosing whole folders to index is better for user experience and this is the current approach it is also very simple to index simple files.
Additional help info can be found in application’s manual (html file).
What components does the Framework contain?
The Framework contains a series of Android activities and support classes. You can use them together or individually.
_FullTextActivity_ – administration activity providing a point of access to Framework functionalities. From this activity you can access indexed files list, indexed folders list to add or remove folders, search for words in current indexed files, change schedule for indexing. Indexing occurs once a day. _AlarmReceiver_ is started at scheduled time and IntentServiceIndex contains all the logic for processing folders and files for indexing. _TextFileIndexer_ provides all the methods for using Lucene engine. The Framework indexes every file by extracting it’s text and adding a Lucene document with Field "contents” to the Lucene index. As it is the Framework indexes text files (it will search only in text files content). For the rest of files types you need to write your own text extractors. Some text extractors were written for : doc, docx, xls, xlsx, ppt, pptx, xml, pdf - but these are not included in the package (might be released as an addon). Of course, you can use _TextFileIndexer_ independently of the scheduling part. _FilesIndexedActivity_ contains the code for displaying a paginated statistic on all files already indexed. This info is kept in database ( see classes in _com.tedrasoft.fulltextsearch.database_ and _com.tedrasoft.fulltextsearch.model_ packages) _FoldersIndexedActivity_ contains the code for displaying a paginated statistic on all folders selected for indexing. This info is kept in database ( see classes in _com.tedrasoft.fulltextsearch.database_ and _com.tedrasoft.fulltextsearch.model_ packages). _AddFolderActivity_ is a folder selection component used to add new folders to indexed folders list _SearchResultsActivity_ shows how a search on Lucene index can be handled and displays the results. Files found can be opened with default applications.