JSword
  1. JSword
  2. JS-196

Some books with Strong's do not contain Feature=StrongsNumbers

    Details

      Description

      Books I have found with Strongs but without the Strongs feature type in their .conf are:
      OSMHB
      RWebster
      SpaTDP
      Byz
      [RST (no longer unavailable)]

      The current suggested workaround is to change:
      o.c.j.book.FeatureType.STRONGS_NUMBER("StrongsNumber");
      to
      o.c.j.book.FeatureType.STRONGS_NUMBER("Strongs");

        Activity

        Hide
        Daniel Owens added a comment -

        So Feature=StrongsNumbers is needed even with GlobalOptionFilter=OSISStrongs?

        Show
        Daniel Owens added a comment - So Feature=StrongsNumbers is needed even with GlobalOptionFilter=OSISStrongs?
        Hide
        DM Smith added a comment -

        Added Strongs as an alias for STRONGS_NUMBER FeatureType.

        Show
        DM Smith added a comment - Added Strongs as an alias for STRONGS_NUMBER FeatureType.
        Hide
        Martin Denham added a comment -

        This appears to be broken again as OSMHB is not recognised as having Strongs Numbers. This means that Strong numbers are probably not part of the OSMHB Lucene index. Also And Bible uses the same check to work out whether to show the Strongs toggle.

        Books are checked for Strongs in various places in JSword e.g.
        StrongsAnalysis.constructor
        book.hasFeature(FeatureType.STRONGS_NUMBERS)
        LuceneIndex.generateSearchIndexImpl
        book.getBookMetaData().hasFeature(FeatureType.STRONGS_NUMBERS)
        But these return false for OSMHB which contains:
        GlobalOptionFilter=OSISStrongs
        But not:
        Feature=StrongsNumbers

        There was a long email chain the led to this bug being created originally:
        http://www.crosswire.org/pipermail/jsword-devel/2011-June/003857.html

        There was a hack that I briefly used at one time involving GlobalOptionFilter but I thought that was unnecessary now.

        I have a junit:

        Book osmhb = Books.installed().getBook("OSMHB");
        assertTrue("OSMHB GlobalOptionFilter hack does not find Strongs", osmhb.getBookMetaData().getProperty("GlobalOptionFilter").toString().contains("Strongs"));
        // failure on next line
        assertTrue("OSMHB not recognised as containing Strongs numbers", osmhb.hasFeature(FeatureType.STRONGS_NUMBERS) || osmhb.getBookMetaData().hasFeature(FeatureType.STRONGS_NUMBERS));
        
        Show
        Martin Denham added a comment - This appears to be broken again as OSMHB is not recognised as having Strongs Numbers. This means that Strong numbers are probably not part of the OSMHB Lucene index. Also And Bible uses the same check to work out whether to show the Strongs toggle. Books are checked for Strongs in various places in JSword e.g. StrongsAnalysis.constructor book.hasFeature(FeatureType.STRONGS_NUMBERS) LuceneIndex.generateSearchIndexImpl book.getBookMetaData().hasFeature(FeatureType.STRONGS_NUMBERS) But these return false for OSMHB which contains: GlobalOptionFilter=OSISStrongs But not: Feature=StrongsNumbers There was a long email chain the led to this bug being created originally: http://www.crosswire.org/pipermail/jsword-devel/2011-June/003857.html There was a hack that I briefly used at one time involving GlobalOptionFilter but I thought that was unnecessary now. I have a junit: Book osmhb = Books.installed().getBook( "OSMHB" ); assertTrue( "OSMHB GlobalOptionFilter hack does not find Strongs" , osmhb.getBookMetaData().getProperty( "GlobalOptionFilter" ).toString().contains( "Strongs" )); // failure on next line assertTrue( "OSMHB not recognised as containing Strongs numbers" , osmhb.hasFeature(FeatureType.STRONGS_NUMBERS) || osmhb.getBookMetaData().hasFeature(FeatureType.STRONGS_NUMBERS));
        Hide
        Martin Denham added a comment -

        I think there is an error in SwordBookMetaData.hasFeature.

        The buffer is updated 3 times before the final check and then not used:

                // Many "features" are GlobalOptionFilters, which in the Sword C++ API
                // indicate a class to use for filtering.
                // These mostly have the source type prepended to the feature
                StringBuilder buffer = new StringBuilder((String) getProperty(ConfigEntryType.SOURCE_TYPE));
                buffer.append(name);
                if (cet.match(ConfigEntryType.GLOBAL_OPTION_FILTER, buffer.toString())) {
                    return true;
                }
        
                // Check for the alias prefixed by the source type
                String alias = feature.getAlias();
                buffer.setLength(0);
                buffer.append((String) getProperty(ConfigEntryType.SOURCE_TYPE));
                buffer.append(alias);
        
                // But some do not
                return cet.match(ConfigEntryType.GLOBAL_OPTION_FILTER, name)
                    || cet.match(ConfigEntryType.GLOBAL_OPTION_FILTER, alias);
        

        I think the final line should be:

                // But some do not
                return cet.match(ConfigEntryType.GLOBAL_OPTION_FILTER, name)
                    || cet.match(ConfigEntryType.GLOBAL_OPTION_FILTER, buffer.toString());
        
        Show
        Martin Denham added a comment - I think there is an error in SwordBookMetaData.hasFeature. The buffer is updated 3 times before the final check and then not used: // Many "features" are GlobalOptionFilters, which in the Sword C++ API // indicate a class to use for filtering. // These mostly have the source type prepended to the feature StringBuilder buffer = new StringBuilder(( String ) getProperty(ConfigEntryType.SOURCE_TYPE)); buffer.append(name); if (cet.match(ConfigEntryType.GLOBAL_OPTION_FILTER, buffer.toString())) { return true ; } // Check for the alias prefixed by the source type String alias = feature.getAlias(); buffer.setLength(0); buffer.append(( String ) getProperty(ConfigEntryType.SOURCE_TYPE)); buffer.append(alias); // But some do not return cet.match(ConfigEntryType.GLOBAL_OPTION_FILTER, name) || cet.match(ConfigEntryType.GLOBAL_OPTION_FILTER, alias); I think the final line should be: // But some do not return cet.match(ConfigEntryType.GLOBAL_OPTION_FILTER, name) || cet.match(ConfigEntryType.GLOBAL_OPTION_FILTER, buffer.toString());
        Hide
        DM Smith added a comment -

        Many thanks. The fix has been checked in.

        Show
        DM Smith added a comment - Many thanks. The fix has been checked in.

          People

          • Assignee:
            DM Smith
            Reporter:
            Martin Denham
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: