[sword-devel] Module index funny results
Will Thimbleby
will at thimbleby.net
Mon Feb 28 17:50:08 MST 2005
Ok, cheers.
Then I'll revert to what I was using before. Now can you tell me how to
get this working -- I've tried many different permutations?
sword::VerseKey textkey;
int t = 0xFF & (index >> 24);
int b = 0xFF & (index >> 16);
int c = 0xFF & (index >> 8);
int v = 0xFF & (index);
textkey.AutoNormalize(0);
textkey.Persist(1);
module->setKey(textkey);
textkey.Verse(v);
textkey.Chapter(c);
textkey.Book(b);
textkey.Testament(t);
NSLog(@"%d", index);
NSLog(@"%d,%d,%d,%d", t,b,c,v);
NSLog(@"%@",fromUTF8((char *)module->getKey()->getText()));
Which prints out:
2005-03-01 00:47:19.416 MacSword[9666] 33620225
2005-03-01 00:47:19.416 MacSword[9666] 2,1,1,1
2005-03-01 00:47:19.416 MacSword[9666] Matthew 1:1
2005-03-01 00:47:19.487 MacSword[9666] 33620240
2005-03-01 00:47:19.488 MacSword[9666] 2,1,1,16
2005-03-01 00:47:19.488 MacSword[9666] Matthew 1:1
2005-03-01 00:47:19.507 MacSword[9666] 33620242
2005-03-01 00:47:19.508 MacSword[9666] 2,1,1,18
2005-03-01 00:47:19.508 MacSword[9666] Matthew 1:1
2005-03-01 00:47:19.537 MacSword[9666] 33620245
2005-03-01 00:47:19.546 MacSword[9666] 2,1,1,21
2005-03-01 00:47:19.546 MacSword[9666] Matthew 1:1
2005-03-01 00:47:19.562 MacSword[9666] 33620249
2005-03-01 00:47:19.563 MacSword[9666] 2,1,1,25
2005-03-01 00:47:19.564 MacSword[9666] Matthew 1:1
Hope FOSDEM was good. cheers --Will
On 1 Mar 2005, at 12:29 am, Troy A. Griffitts wrote:
> 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
>
> _______________________________________________
> 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