<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>When I extract the section headers using the search function this
      takes ~700ms for Psalms (on my Core i7, measured on JavaScript
      side). I suppose it is much slower on a tablet or phone.</p>
    <p>Is there any way to speed up this operation in the SWORD engine?<br>
      <br>
      Best regards,<br>
      Tobias<br>
    </p>
    <div class="moz-cite-prefix">On 5/23/21 2:20 PM, Tobias Klein wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:693db61b-a949-f607-16b4-ba3e81cf04d4@tklein.info">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <p>Thanks, Troy.</p>
      <p>The issue was that I previously hadn't used this:</p>
      <pre style="color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; overflow-wrap: break-word; white-space: pre-wrap;">mgr.setGlobalOption("Headings", "On");</pre>
      <div class="moz-cite-prefix">My new helper function now works
        after using that call initially.<br>
      </div>
      <div class="moz-cite-prefix"><br>
        Best regards,<br>
        Tobias<br>
      </div>
      <div class="moz-cite-prefix"><br>
      </div>
      <div class="moz-cite-prefix">On 5/22/21 11:09 PM, Troy A.
        Griffitts wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:E1B40477-C913-410B-A1DE-F92E34D5F305@crosswire.org">
        <meta http-equiv="content-type" content="text/html;
          charset=UTF-8">
        Hi Tobias. Have a look at sword/examples/cmdline/search.cpp. I
        believe it takes an optional range parameter.<br>
        <br>
        <br>
        <br>
        <div class="gmail_quote">On May 22, 2021 7:49:48 PM GMT+02:00,
          Tobias Klein <a class="moz-txt-link-rfc2396E"
            href="mailto:contact@tklein.info" moz-do-not-send="true"><contact@tklein.info></a>
          wrote:
          <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
            0.8ex; border-left: 1px solid rgb(204, 204, 204);
            padding-left: 1ex;">
            <pre class="k9mail">Hi Troy,

I can't seem to get the scope parameter of the search function right ... 
I either get crashes or no results.

How do I have to initialize the scope parameter for the module search so 
that I get the headings for one particular Bible book as search results?

Best regards,
Tobias

On 4/12/21 9:07 PM, Troy A. Griffitts wrote:
<blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> Sure Tobias,

 module->getEntryAttributes() will allow you to pull the headings from a
 verse, and

 an Entry Attributes search for '/Heading' will give you only the verses
 with Heading entries attributes.

 I've thrown together a quick example here, which you can use with
 something like:

 ./showHeadings NASB Matt-John

 which will give you the headings from the Gospels.

 <a href="https://crosswire.org/svn/sword/trunk/examples/tasks/findHeadings.cpp" moz-do-not-send="true">https://crosswire.org/svn/sword/trunk/examples/tasks/findHeadings.cpp</a>

 Creating this example, I found I needed to fix a bug in the engine.  The
 engine Entry Attributes search lets you search for values in the entry
 attributes (e.g., a Strong's number 1234).  In your use case, when
 searching, you don't care about the value; you only care about
 presence.  This wasn't working, but simple presence can now be searched
 for with my latest commit.

 Hope this helps,

 Troy


 On 4/12/21 9:31 AM, Tobias Klein wrote:
<blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> Hi,

 I have been getting a request from a user to render section headings independently of the currently opened bible translation module.

 So for example when opening the KJV still using the section/chapter headers of the NASB.

 This would be useful in those cases when the respective bible translation module does not come with section/chapter headers, but another one does.

 A requirement would be to efficiently extract section/chapter headers from a module using the SWORD API. As of now I only see that you can iterate over the verses of a book and individually scan each verse for the headers. Is there a more efficient way of doing that?

 Another use case could be to render a book outline. This is what I am already doing now in Ezra, but in a way that is not so clean (I am traversing the DOM looking for all section header elements of the current book).

 Best regards,
 Tobias<hr> sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org" moz-do-not-send="true">sword-devel@crosswire.org</a>
 <a href="http://crosswire.org/mailman/listinfo/sword-devel" moz-do-not-send="true">http://crosswire.org/mailman/listinfo/sword-devel</a>
 Instructions to unsubscribe/change your settings at above page
</blockquote><hr>sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org" moz-do-not-send="true">sword-devel@crosswire.org</a>
<a href="http://crosswire.org/mailman/listinfo/sword-devel" moz-do-not-send="true">http://crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page
</blockquote><hr>sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org" moz-do-not-send="true">sword-devel@crosswire.org</a>
<a href="http://crosswire.org/mailman/listinfo/sword-devel" moz-do-not-send="true">http://crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page</pre>
          </blockquote>
        </div>
        <br>
        -- <br>
        Sent from my Android device with K-9 Mail. Please excuse my
        brevity. </blockquote>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a>
<a class="moz-txt-link-freetext" href="http://crosswire.org/mailman/listinfo/sword-devel">http://crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page</pre>
    </blockquote>
  </body>
</html>