[jsword-devel] Cannot search last 2 verses of Revelation
Chris Burrell
chris at burrell.me.uk
Sat Jul 19 05:34:31 MST 2014
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
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20140719/7fe0356b/attachment-0001.html>
More information about the jsword-devel
mailing list