<div dir="ltr">Hi all<div><br></div><div style>getGlobalKeyList() seems to do a lot of work against the file system. </div><div style><br></div><div style>I'm attempting to create a sitemap, which includes a URL to every chapter. Presumably getGlobalKeyList is what I want to ensure that I'm only displaying those chapters that exist. I was intending to do:</div>
<div style><br></div><div style>globalKeyList = getGlobalKeyList();</div><div style>for(each book in versification) {</div><div style> myBookKey = book.getValidKey(book.getShortName())</div><div style> myBookKey.retainAll(globalKeyList);</div>
<div style><br></div><div style> if(myBookKey.getCardinality() > 0) {</div><div style> outputSiteMapChapter();</div><div style> }</div><div style>}</div><div style><br></div><div style>So for each version I call getGlobalKeyList(), but that in terms seem to make individual reads (through the contains()) method for every potential key in the versification.</div>
<div style><br></div><div style><div>public final Key getGlobalKeyList() {</div><div> if (global == null) {</div><div> Versification v11n = Versifications.instance().getVersification(versification);</div>
<div> global = keyf.createEmptyKeyList(v11n);</div><div> Key all = keyf.getGlobalKeyList(v11n);</div><div> for (Key key : all) {</div><div> if (contains(key)) {</div><div> global.addAll(key);</div>
<div> }</div><div> }</div><div> }</div><div> return global;</div><div>}</div><div><br></div><div style>The contains() method above makes a backend call every time.</div><div style><br>
</div><div style>Isn't there a way to obtain the list of keys from the index? I'm not quite sure where the versification comes in here, or is it there simply to map the names of the keys to their positions in the index file? If so, can we simply read all keys in OT and NT, and check </div>
<div style><br></div><div style>Doing this on GlobalKeyList() would also speed up index creation.</div><div style><br></div><div style>Finally, it seems contains() only works on a single key, or takes the first key/verse if it's a passage. Presumably that is correct?</div>
<div style><br></div><div style>Chris<br></div><div style><br></div></div></div>