[sword-devel] Multi word search also returns matches based on headlines or footnotes

Tobias Klein contact at tklein.info
Sun Mar 23 13:18:52 EDT 2025


Hi Troy,

I did some debugging on this and found the following.

The behavior of the multi word search is described in the code of 
swmodule.cpp

// First we check getRawEntry because it's the fastest;
// it might return false positives because all the markup is include, 
but is the quickest
// way to eliminate a verse. If it passes, then we do the real work to 
*strip the markup* and
// really test the verse for our keywords.

It seems that the second part (testing on the stripped markup) fails.

I printf-debugged this part. The testBuf variable in case of Deuteronomy 
28:15 contains the following string:

CONSEQUENCES OF DISOBEDIENCE “LEV 26:14-43; JOSH 23:15; DAN 9:11BUT IT 
SHALL COME ABOUT, IF YOU DO NOT LIT LISTEN TO THE VOICE OFOBEY THE LORD 
YOUR GOD, TO OBSERVE TO DO ALL HIS COMMANDMENTS AND HIS STATUTES WITH 
WHICH I CHARGE YOU TODAY, THAT ALL THESE CURSES WILL COME UPON YOU AND 
OVERTAKE YOU:

As you can see, the /testBuf/ variable contains both the/header/ as well 
as /cross references/ as well as a /foot note/.

The search algorithm as such is supposed to only return a match if the 
number of occurances related to the markup string matches the number of 
occurances of the stripped string. However, it seems that the 
/stripText()/ is not behaving correctly here and therefore the stripped 
string contains markup content that it should not contain (header, 
cross-refs, foot-notes).

Any pointers?

Best regards,
Tobias

On 3/23/25 09:16, Tobias Klein wrote:
>
> Hi Troy,
>
> is it intentional that the SWORD search also returns matches based on 
> headlines or footnotes?
>
> E.g. when I have the following search configuration:
>
> Search type: Multi word search
> Term: not listen Lord
> Module: NASB
>
> Among others, I get the result *Deuteronomy 28:15*.
>
> “But it shall come about, if you do *not* obey the *Lord* your God, to 
> observe to do all His commandments and His statutes with which I 
> charge you today, that all these curses will come upon you and 
> overtake you: "
>
> In this particular case the term "listen" is not part of the Bible 
> text, but rather only part of the footnote of "obey" (Lit *listen* to 
> the voice of).
>
> I configured the respective SWMgr with Footnotes turned off:
> this->_searchMgr->setGlobalOption("Footnotes", "Off");
>
> However, unexpectedly the search is still returning this verse as a 
> result.
> Similar behavior can be observed with search results matching headers.
>
> I'd rather not have search results based on footnotes or headers.
>
> Best regards,
> Tobias
>
>
> _______________________________________________
> sword-devel mailing list:sword-devel at crosswire.org
> http://crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://crosswire.org/pipermail/sword-devel/attachments/20250323/a8c6313a/attachment.htm>


More information about the sword-devel mailing list