[jsword-devel] Cannot search last 2 verses of Revelation
Chris Burrell
chris at burrell.me.uk
Sat Jul 19 16:10:40 MST 2014
Esv is Nrsv btw
On 19 Jul 2014 21:18, "Martin Denham" <mjdenham at gmail.com> wrote:
> Interestingly, NT only modules like Common do not have this problem, and
> nor do the KJVA or NHEBME (NRSV v11n).
>
> This problem may possibly only affect modules with KJV v11n.
>
> Martin
>
>
> On 19 July 2014 19:27, DM Smith <dmsmith at crosswire.org> wrote:
>
>> getCount(currentTestament) should return the number of keyed entries in
>> the Testament. Indexing is 0 based.
>>
>> So the -1 was right and the bug is in getCount. It is returning 2 less
>> than it should.
>>
>> There are a couple of different ways that getCount can be computed. The
>> index file contains 1 fixed size entry for each key. Dividing the size of
>> the index by the size of an entry will give the number of entries in the
>> file.
>>
>> The other way is to compute the number of entries in the v11n. Basically,
>> each book has a Chapter 0. Each chapter has a verse 0. There also is a
>> verse 0 for the testament.
>>
>> I'd have to look to see how getCount(Testament) is written.
>>
>> The problem with changing the -1 to +1 is that it might break for the OT.
>>
>> I was happily surprised last night that even more family dropped in for
>> the weekend. Doubt I'll be able to look at it soon.
>>
>> In Him,
>> DM
>>
>> On Jul 19, 2014, at 8:34 AM, Chris Burrell <chris at burrell.me.uk> wrote:
>>
>> Fixing to this: int maxIndex = v11n.getCount(currentTestament) + 1;
>>
>> seems to sort the issue out - however, not sure I understand why. I
>> could understand v11n.getCount(), but not v11n.getCount()+1. Is there an
>> issue perhaps in v11n.getCount() as well?
>>
>> I'm afraid I don't understand the index (non-lucene) file enough to fix
>> this properly
>> Chris
>>
>>
>>
>> On 19 July 2014 13:17, Chris Burrell <chris at burrell.me.uk> wrote:
>>
>>> @Test
>>> public void testMe() {
>>>
>>> assertTrue(Books.installed().getBook("ESV").getGlobalKeyList().contains(new
>>> Verse(Versifications.instance().getVersification("NRSV"), BibleBook.REV,
>>> 22, 21)));
>>>
>>> }
>>>
>>>
>>> On 19 July 2014 13:16, Chris Burrell <chris at burrell.me.uk> wrote:
>>>
>>>> The issue with this method here. Lucene relies on getGlobalKeyList, but
>>>> that doesn't return the right number of keys. It seems to chop off the end
>>>>
>>>> @Override
>>>> public Key getGlobalKeyList() throws BookException {
>>>> ZVerseBackendState rafBook = null;
>>>> try {
>>>> rafBook = initState();
>>>>
>>>> String v11nName =
>>>> getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
>>>> Versification v11n =
>>>> Versifications.instance().getVersification(v11nName);
>>>>
>>>> Testament[] testaments = new Testament[] {
>>>> Testament.OLD, Testament.NEW
>>>> };
>>>>
>>>> BitwisePassage passage = new RocketPassage(v11n);
>>>> passage.raiseEventSuppresion();
>>>> passage.raiseNormalizeProtection();
>>>>
>>>> for (Testament currentTestament : testaments) {
>>>> RandomAccessFile idxRaf =
>>>> rafBook.getIdxRaf(currentTestament);
>>>>
>>>> // If Bible does not contain the desired testament,
>>>> then false
>>>> if (idxRaf == null) {
>>>> // no keys in this testament
>>>> continue;
>>>> }
>>>>
>>>> int maxIndex = v11n.getCount(currentTestament) - 1;
>>>>
>>>> // Read in the whole index, a few hundred Kb at most.
>>>> byte[] temp = SwordUtil.readRAF(idxRaf, 0,
>>>> IDX_ENTRY_SIZE * maxIndex);
>>>>
>>>> // For each entry of 10 bytes, the length of the verse
>>>> in bytes
>>>> // is in the last 2 bytes. If both bytes are 0, then
>>>> there is no content.
>>>> for (int ii = 0; ii < temp.length; ii +=
>>>> IDX_ENTRY_SIZE) {
>>>> // This can be simplified to temp[ii + 8] == 0 &&
>>>> temp[ii + 9] == 0.
>>>> // int verseSize =
>>>> SwordUtil.decodeLittleEndian16(temp, ii + 8);
>>>> // if (verseSize > 0) {
>>>> if (temp[ii + 8] != 0 || temp[ii + 9] != 0) {
>>>> int ordinal = ii / IDX_ENTRY_SIZE;
>>>>
>>>> passage.addVersifiedOrdinal(v11n.getOrdinal(currentTestament, ordinal));
>>>> }
>>>> }
>>>> }
>>>>
>>>> passage.lowerNormalizeProtection();
>>>> passage.lowerEventSuppressionAndTest();
>>>>
>>>> return passage;
>>>> } catch (IOException e) {
>>>> throw new BookException(JSMsg.gettext("Unable to read key
>>>> list from book."));
>>>> } finally {
>>>> OpenFileStateManager.release(rafBook);
>>>> }
>>>> }
>>>>
>>>> Chris
>>>>
>>>>
>>>>
>>>> On 19 July 2014 11:15, Martin Denham <mjdenham at gmail.com> wrote:
>>>>
>>>>> For clarification, this is different to the search problem I mentioned
>>>>> yesterday.
>>>>>
>>>>> I won't be able to look at this for at least a few days, and I am not
>>>>> so knowledgeable regarding Lucene, so if anybody else fixes it in the mean
>>>>> time - great.
>>>>>
>>>>> Martin
>>>>>
>>>>>
>>>>> On 19 July 2014 09:24, Martin Denham <mjdenham at gmail.com> wrote:
>>>>>
>>>>>> This bug affects both STEP and And Bible so it probably affects most
>>>>>> JSword apps.
>>>>>>
>>>>>> No search results are returned for the last 2 verses of Revelation.
>>>>>>
>>>>>> *Examples*
>>>>>> If you search for 'Amen'
>>>>>> <http://www.stepbible.org/?q=version=ESV%7Ctext=Amen&options=VNHUG&pos=1>
>>>>>> you see many results but the last is in Rev 19, not Rev 22 and the last 2
>>>>>> verses of Revelation contain Amen.
>>>>>>
>>>>>> Searching for 'Jesus' in Rev 22
>>>>>> <http://www.stepbible.org/?q=version=ESV%7Creference=Rev.22%7Ctext=Jesus&options=VNHUG&pos=1>
>>>>>> yields only verse which is verse 16 and omits verses 21 and 22.
>>>>>>
>>>>>> Martin
>>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> jsword-devel mailing list
>>>>> jsword-devel at crosswire.org
>>>>> http://www.crosswire.org/mailman/listinfo/jsword-devel
>>>>>
>>>>>
>>>>
>>>
>> _______________________________________________
>> jsword-devel mailing list
>> jsword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/jsword-devel
>>
>>
>>
>> _______________________________________________
>> jsword-devel mailing list
>> jsword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/jsword-devel
>>
>>
>
> _______________________________________________
> jsword-devel mailing list
> jsword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20140720/eaa85c0c/attachment-0001.html>
More information about the jsword-devel
mailing list