[sword-devel] Module index funny results
Troy A. Griffitts
scribe at crosswire.org
Mon Feb 28 17:29:13 MST 2005
Will,
Index has been messed up for some time. It currently returns the index
into the 'testament' (old or new). The drivers have ot and nt data
files and Index is used to compute the offset. It's dumb. I know. It
needs to change. There is a NewIndex() method that should soon be
renamed to replace the current Index() method. You should be able to
call vk->Index(vk->NewIndex());
Hmmm... I'm sorry. Now that I look at your code, I'm not sure what's
up. I would have though Mat.3.16 would have been an index much smaller
than 24124.
AH!!! Sorry. Now I see. Yes! SWModule::Index was added for a
previous implementation of a search engine which was submitted a couple
years back. It was not accepted for a number of reasons, which included
using external lexical parsing libraries and other things what were
never cleaned up. I thought he had the SWModule::Index thing working
though. I don't think anyone else uses it (obviously not if it's
broken). Traditionally, it's against our container/key_domain concept
to force a container to return a hash number for each of it's entries,
though this is, in all practical senses, doable because the driver has a
fixed number of entries on the disk. The safest way is to store the key
value and use the key class to do the comparison. I know it's not more
efficient than a 'long', but it's safest and works and will still work,
even if entries have been added to the module.
Sorry, Index() should be fixed or removed.
-Troy.
Will Thimbleby wrote:
> Hi, Can someone help me with this code:
>
>
> sword::VerseKey textkey = "matt3.16";
> module->setKey(textkey);
> NSLog(@"%d %@",module->Index(),fromUTF8((char
> *)module->getKey()->getText()));
> module->Index(module->Index());
> NSLog(@"%d %@",module->Index(),fromUTF8((char
> *)module->getKey()->getText()));
>
> which prints:
>
> 24124 Matthew 3:16
> 24065 Matthew 1:7
>
> I would have though module->Index(module->Index()); should change
> nothing. I'm trying to use the module's index to create lucene indexes,
> so that I can properly sort the results easily. I've been hacking lucene
> quite a bit and will post my thoughts later, I just need to fix this.
>
> cheers --Will
>
> _______________________________________________
> sword-devel mailing list
> sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
More information about the sword-devel
mailing list