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

Troy A. Griffitts scribe at crosswire.org
Thu Nov 22 10:51:46 MST 2007


Sorry, double equals (==) typo.  Should be: results = TOP


Troy A. Griffitts wrote:
> No Barry, these are the right questions.  Good job hunting down the 
> search code.  My apologies for not being more responsive.  Just returned 
> from a conference and it is a holiday weekend here in the States.
> 
> First look, I would change the for loop to something like this:
> 
> for (results == TOP; !results.Error(); results++) {
> searcher->addResult(toUString(String(results.getText())));
> }
> 
> 
> Barry Drake wrote:
>> 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
>>
>>
>> _______________________________________________
>> sword-devel mailing list: sword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/sword-devel
>> Instructions to unsubscribe/change your settings at above page
> 
> 
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page




More information about the sword-devel mailing list