<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Sijo asked this via github. Thought it'd be good to get feedback here.<div><br></div><div>-- DM<br><div><br><div>Begin forwarded message:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; color:rgba(0, 0, 0, 1.0);"><b>From: </b></span><span style="font-family:'Helvetica';">Sijo Cherian &lt;<a href="mailto:notifications@github.com">notifications@github.com</a>&gt;<br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; color:rgba(0, 0, 0, 1.0);"><b>Subject: </b></span><span style="font-family:'Helvetica';"><b>[jsword] JS-98: IndexManager.needsReindexing(Book book); as the API to detect if per-book index need to be recreated  (#74)</b><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; color:rgba(0, 0, 0, 1.0);"><b>Date: </b></span><span style="font-family:'Helvetica';">March 29, 2014 at 7:31:52 PM EDT<br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; color:rgba(0, 0, 0, 1.0);"><b>To: </b></span><span style="font-family:'Helvetica';">crosswire/jsword &lt;<a href="mailto:jsword@noreply.github.com">jsword@noreply.github.com</a>&gt;<br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; color:rgba(0, 0, 0, 1.0);"><b>Reply-To: </b></span><span style="font-family:'Helvetica';">crosswire/jsword &lt;<a href="mailto:reply+i-30455246-2897689b705296a200fa088d2af792bed6bc6a4a-1645068@reply.github.com">reply+i-30455246-2897689b705296a200fa088d2af792bed6bc6a4a-1645068@reply.github.com</a>&gt;<br></span></div><br><div><p>Following is the upgrade criteria implemented by comparing IndexMetadata from prop files: needsReindexing returns true, if Latest.Index.Version.xxx &gt; Installed.Index.Version.xxx OR if {index folder} is not found at all.</p>

<ul>
<li>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</li>
<li>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.</li>
<li>This pull request, still assumes index version as 1.2, so should not break anything</li>
</ul><p>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.   </p><p>ToDo/Questions: <br>
1. Managing the add/update of values in InstalledIndex.prop programmatically<br>
2. Need recommendation on suitable location for InstalledIndex.prop file (perhaps as {IndexFolder}/JSword/lucene/js.index.metadata.prop  file) <br>
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. <br>
4. How do the clients want the DownloadIndex option to work with index versioning?</p>

<hr>

<h4>You can merge this Pull Request by running</h4>
<pre>  git pull <a href="https://github.com/sijocherian/jsword">https://github.com/sijocherian/jsword</a> master</pre><p>Or view, comment on, or merge it at:</p><p>&nbsp;&nbsp;<a href="https://github.com/crosswire/jsword/pull/74">https://github.com/crosswire/jsword/pull/74</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>JS-98 : mechanism to detect if index need to be recreated by comparing IndexMetadata from prop file for now  Started partially with the patch from Tonny Kohar dated 15/May/09</li>
  <li>- Added InstalledIndex.prop file (location of this file TBD)</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/crosswire/jsword/pull/74/files#diff-0">src/main/java/org/crosswire/jsword/bridge/BookIndexer.java</a>
    (20)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/crosswire/jsword/pull/74/files#diff-1">src/main/java/org/crosswire/jsword/index/IndexManager.java</a>
    (16)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/crosswire/jsword/pull/74/files#diff-2">src/main/java/org/crosswire/jsword/index/lucene/IndexMetadata.java</a>
    (29)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/crosswire/jsword/pull/74/files#diff-3">src/main/java/org/crosswire/jsword/index/lucene/InstalledIndex.java</a>
    (67)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/crosswire/jsword/pull/74/files#diff-4">src/main/java/org/crosswire/jsword/index/lucene/LuceneIndexManager.java</a>
    (53)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/crosswire/jsword/pull/74/files#diff-5">src/main/resources/IndexMetadata.properties</a>
    (18)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/crosswire/jsword/pull/74/files#diff-6">src/main/resources/InstalledIndex.properties</a>
    (39)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/crosswire/jsword/pull/74/files#diff-7">src/test/java/org/crosswire/jsword/index/lucene/LuceneIndexManagerTest.java</a>
    (131)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href="https://github.com/crosswire/jsword/pull/74.patch">https://github.com/crosswire/jsword/pull/74.patch</a></li>
  <li><a href="https://github.com/crosswire/jsword/pull/74.diff">https://github.com/crosswire/jsword/pull/74.diff</a></li>
</ul><p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/crosswire/jsword/pull/74">view it on GitHub</a>.<img src="https://github.com/notifications/beacon/1645068__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxMTc1NTExMiwiZGF0YSI6eyJpZCI6Mjg4Mzg1MzF9fQ==--402ceb14a26bfa3b424dc733399b498ea3f0343f.gif" height="1" width="1"></p>
</div></blockquote></div><br></div></body></html>