[sword-devel] SwordReader ........

Barry Drake b.drake at ntlworld.com
Thu Nov 22 05:35:35 MST 2007


Hi there ........

I've been looking at the code in SwordReader SwordIndex.cpp.  The 
following fragment is responsible for retruning and displaying the 
results of a search.

    Verse verses(from,to);
    sword::ListKey results;
    searcher->setProgress(20);

// this next call is the one that does the search
    results=bible->search(
        toCString(text).c_str(),
        (method==METHODMULTIWORD)?-2:-1,
        2 /* case insensitive */,
        &verses
    );
// the above 6 lines carry out the search and return the verse 
references as a 'ListKey' item
    for (int i=0;i<results.Count();i++) {
        
searcher->addResult(toUString(String(results.getElement(i)->getText())));
    }
// the above adds the ListKey elements to the window for display

This used to work OK in the binaries that Johan Gorter provided in 
2004.  Troy has made a few alterations to make the frontend build 
against the current Sword engine.  Currently, the correct number of 
search hits are recorded, but all of them show as the first 'hit'.  As 
an example, searching the book of Amos for 'amos' gets seven hits - the 
correct number.  But all of them are returned as 'Amos 1:1' which is the 
first hit. 

As far as I can see, Troy has not modified anything that could affect 
the search, so I guess something has changed in the way in which 
SWModule::search operates.  Has anything changed here that could affect 
operation?  Or has something changed in the ListKey::GetElement() 
function?  I hope I'm not asking too dumb a question here.

God bless, 
Barry

-- From Barry Drake (The Revd) minister of the Netherfield United Reformed church, Nottingham see http://www.jesusinnetherfield.org.uk for our church homepages).

Replies - b.drake at ntlworld.com




More information about the sword-devel mailing list