[bt-devel] save search anlaysis - updated

Martin Gruner bt-devel@crosswire.org
Wed, 19 Dec 2001 17:51:19 +0100


Hey Mark,

const CSwordModuleSearch::scopeType CSearchDialogScopeChooser::getScopeType()

should tell you which kind of scope was used. This may be none, the last 
search result or a special scope. 

case 2: ListKey& CSwordModuleInfo::getSearchResult()
case 3: ListKey CSearchDialogScopeChooser::getScope()

Case 1: all books in scope. You could filter out books without hits, but this 
is not too easy -- you can just display all books, even with 0 hits. See 
description of case 2.
Case 2 might become too complicated and should therefore be handled as case 
1. Or if you want to implement it correctly you will have to merge the search 
result ListKeys of all modules of the last search and then determine the used 
books.
In case 3 you should use the ListKey (special sword class, have a look at it 
in the api-docs of sword). You can then iterate through this listkey to find 
out which books were included in the scope (also partially).
Case 3 is the normal range using case. 

Another way would be using the search result to find out about the books. 
This would be the most easy solution, and would not require a different 
handling of the 3 cases -- and filter out books without hits. You still have 
to merge the search results of the different modules, though.

const unsigned int CSearchDialogAnalysis::getCount( const QString book, 
CSwordModuleInfo* module )
might be helpful here. A count of 0 would indicate no hits in this module. 
Just get all available books, and execute this function for each book in each 
module to find out which books were used.

I hope I told you new and helpful things and I was clear enough.

Martin

> I figured a little discussion might help this along.  To me the way to
> limit the books on the output html page it to get a list of the books
> that were within the scope.  Then iterate through that list when
> building the page.
>
> Currently, the code is using the CSwordVerseKey class (starting with
> Genesis 1:1), and calling NextBook until it runs out of books.
>
> My initial thought was to get the scope (in the form of a list of
> verses) possibly from the CSwordModuleSearch class (would have to be
> modified to return the scope), then use that list to identify the books
> in question. I don't see a class which takes a list of verses and will
> iterate through the books like the CSwordVerseKey does though. Is there
> such a tool available?  One option is to go through each verse and
> compare the book to the previous, but i think that is less than desired.
>
> Any insights/thoughts/bashing, etc regarding this.  I'm most likely
> missing the obvious on this.