[sword-devel] BibleTime indexing problem

Gary Holmlund gary.holmlund at gmail.com
Mon Feb 27 21:05:58 MST 2012


I am investigating why the searching in BibleTime for the HunKar Bible 
begins
in Malachi instead of Genesis. I found that BibleTime is building the index
incorrectly. This only happens with sword 1.6.2, not 1.6.1. Further 
debuging
gets to the following BibleTime code in CSwordModuleInfo::buildIndex:

         m_module->setPosition(sword::TOP);


Looking into member variables of m_module after the setPosition I see that
"book" is set to 39 which is Malachi. It should be set to 1 for Genesis.
Tracing down through sword "book" is set to 39 in sword:VerseKey::Normalize.
Here is the call stack from setPosition down to Normalize:

0    sword::VerseKey::Normalize    versekey.cpp    1276    0xb7e77d78
1    sword::VerseKey::setBook    versekey.cpp    1434    0xb7e783c3
2    sword::VerseKey::Book    versekey.h    312    0x8154931
3    sword::VerseKey::ParseVerseList    versekey.cpp    522    0xb7e751b9
4    sword::VerseKey::parse    versekey.cpp    288    0xb7e74785
5    sword::VerseKey::setText    versekey.h    220    0x8154830
6    sword::SWKey::copyFrom    swkey.cpp    181    0xb7e6f19c
7    sword::VerseKey::copyFrom    versekey.cpp    207    0xb7e741d6
8    sword::SWKey::positionFrom    swkey.h    167    0x8152825
9    sword::VerseKey::positionFrom    versekey.cpp    152    0xb7e73ec5
10    sword::SWKey::operator=    swkey.h    225    0xb7eaafa9
11    sword::zText::increment    ztext.cpp    178    0xb7f001a5
12    sword::zText::decrement    ztext.h    65    0xb7f004f1
13    sword::SWModule::operator-=    swmodule.h    674    0x815299f
14    sword::SWModule::operator--    swmodule.h    674    0x81529ff
15    sword::SWModule::setPosition    swmodule.cpp    368    0xb7ea81c9
16    CSwordModuleInfo::buildIndex    cswordmoduleinfo.cpp 262 0x813aa07


In sword::VerseKey::ParseVerseList I see something that does not seem right.
The curKey->Book(0) seems like it should not have a "0" parameter. When it
does have the "0" parameter, book is set to 39. I think it should be "1".
This code is executed when using the HunKar Bible, but not other Bibles 
I tested.

     if ((!strncmp(buf, "[ Testament ", 12)) &&
         (isdigit(buf[12])) &&
         (!strcmp(buf+13, " Heading ]"))) {
         curKey->Verse(0);
         curKey->Chapter(0);
         curKey->Book(0);  // versekey.cpp line 522 ::ParseVerseList


book is set to 39 by the following code in sword:VerseKey::Normalize

        if (book < 1) {
         if (--testament > 0) {
          book += BMAX[testament-1]; // versekey.cpp line 1274 ::Normalize
         }
         continue;
        }


I am hoping that some more familiar with the sword code can comment
on this.

Gary Holmlund



More information about the sword-devel mailing list