crosswire/jsword — pull request #74 by sijocherian (2014-03-29 23:31:51+00:00)
Title: JS-98: IndexManager.needsReindexing(Book book); as the API to detect if per-book index need to be recreated 

Following is the upgrade criteria implemented by comparing IndexMetadata from prop files: needsReindexing returns true, if Latest.Index.Version.xxx > Installed.Index.Version.xxx OR if {index folder} is not found at all.

- For now uses two prop file: 1. IndexMetadata.prop file (can be updated with each release of JSword) 2. InstalledIndex.prop file for "Installed.Index.Version.xx" values that should stay persistent on clients computer between upgrades
- Support for PerBookVersion property: Since index creation api is per Book based, added support for (optional) PerBookVersion properties to allow selective upgrade of one book's index, if needed.
- This pull request, still assumes index version as 1.2, so should not break anything

Notes: Looked into storing version values in the lucene index using FlexibleIndexing in lucene 4.0, but that seem very dependent on lucene api. Prop file gives human readable configuration and easy to debug.

ToDo/Questions:
1. Managing the add/update of values in InstalledIndex.prop programmatically
2. Need recommendation on suitable location for InstalledIndex.prop file (perhaps as {IndexFolder}/JSword/lucene/js.index.metadata.prop file)
3. Need to add reindexAllBooksIfNeeded() API, that folks (AndBible, BD, Alkitab and?) can use to upgrade all index as bulk, for the installed books , only then the DefaultInstalledVersion can be updated. o.c.j.bridge.BookIndexer.java shows a sample API in the comments.
4. How do the clients want the DownloadIndex option to work with index versioning?