[jsword-devel] Missing search results when filtered if PassageType.MIX

Martin Denham mjdenham at gmail.com
Fri Jul 18 14:30:16 MST 2014


I believe I have found the problem.  The comparison half way through this
method in VerseRange.java should be '>=' not '<='.

   public static VerseRange intersection(VerseRange a, VerseRange b) {
        Versification v11n = a.getVersification();
        Verse new_start = v11n.max(a.getStart(), b.getStart());
        Verse new_end = v11n.min(a.getEnd(), b.getEnd());

        if (v11n.distance(new_start, new_end) <= 0) {
            return new VerseRange(a.getVersification(), new_start, new_end);
        }

        return null;
    }

This would affect search results that were adjacent when using
RangedPassage.

I will do a few tests and make a pull request tomorrow or soon after.

Martin


On 17 July 2014 23:10, Martin Denham <mjdenham at gmail.com> wrote:

> I have noticed that occasionally some search results are missing when a
> filter is applied e.g find 'light' in Gospel of John only.
>
> E.g. search text: '+[John] +light' returns only 4 results. It should
> return 16 results.
>
> I have done a bit of analysis and narrowed the problem down to And Bible
> using RangedPassage via PassageKeyFactory.setDefaultType(PassageType.MIX).
>  If I switch back to the default passage type I get the correct results.
>
> The JSword search classes eventually calls: AndQuery.find()
> which has: left.retainAll(right);
> which calls: RangedPassage.retainAll
>
> I think the error might have already occurred in the left value above or
> in retainAll.  I need to do some more debugging but if anybody has any
> suggestions as to what might be wrong I would be grateful.
>
> Martin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20140718/aaa1bf0a/attachment.html>


More information about the jsword-devel mailing list