Changed a test in order to avoid a bug in Xapian

Xapian version 1.4.18 contains a bug in snippet generation caused by
incorrect handling of stemming.

The test-point with a search pattern "beatles" produced snippets with no
highlights of the search term. Debugging showed that the search pattern
"beatles" was transformed to a search term "beatl" which then didn't
match the word "beatles" in the text from which a snippet had to be
extracted.

The test case passed on my development machine as well as for most CI
configurations. However the "Packages / build-deb (ubuntu-bionic)"
variant failed because of a slightly different handling of punctuation
at the snippet boundaries:

Test context:
  url: /ROOT/search?pattern=beatles&content=zimfile
  actual snippet:   ...side "Yellow Submarine" ...........
  expected snippet: ...-side "Yellow Submarine" ...........

Above mismatch resulted in a looser comparison of the snippet contents
and failed the requirement that the snippet MUST contain highlights
(this is how the said bug in Xapian was discovered).

An attempt to change the search pattern to "field" didn't eliminate the
problem. Despite the search pattern itself being in singular form (i.e.
identical to its stemmed version) the plural form "fields" in the
snippet was still not highlighted.

Using for a search pattern an adjective instead of a noun achieved the
desired outcome.
This commit is contained in:
Veloman Yunkan 2022-05-15 11:39:41 +04:00
parent eeca88573b
commit 8f2f93371b
1 changed files with 6 additions and 6 deletions

View File

@ -1797,7 +1797,7 @@ R"SEARCHRESULT(
},
{
/* pattern */ "beatles",
/* pattern */ "yellow",
/* start */ -1,
/* resultsPerPage */ 0,
/* totalResultCount */ 2,
@ -1807,18 +1807,18 @@ R"SEARCHRESULT(
<a href="/ROOT/zimfile/A/Eleanor_Rigby">
Eleanor Rigby
</a>
<cite>...a mainly rock and roll- and pop-oriented act to a more experimental, studio-based band. With a double string quartet arrangement by George Martin and striking lyrics about loneliness, "Eleanor Rigby" broke sharply with popular music conventions, both musically and lyrically. Richie Unterberger of AllMusic cites the band's "singing about the neglected concerns and fates of the elderly" on the song as "just one example of why the Beatles' appeal reached so far beyond the traditional rock audience"....</cite>
<cite>...-side "<b>Yellow</b> Submarine" (double A-side) Released 5 August 1966 (1966-08-05) Format 7-inch single Recorded 2829 April &amp; 6 June 1966 Studio EMI, London Genre Baroque pop, art rock Length 2:08 Label Parlophone (UK), Capitol (US) Songwriter(s) LennonMcCartney Producer(s) George Martin The Beatles singles chronology "Paperback Writer" (1966) "Eleanor Rigby" / "<b>Yellow</b> Submarine" (1966) "Strawberry Fields Forever" / "Penny Lane" (1967) Music video "Eleanor Rigby" on YouTube The song continued the......</cite>
<div class="book-title">from Ray Charles</div>
<div class="informations">201 words</div>
)SEARCHRESULT",
R"SEARCHRESULT(
<a href="/ROOT/zimfile/A/True_to_Life_(Ray_Charles_album)">
True to Life (Ray Charles album)
<a href="/ROOT/zimfile/A/If_You_Go_Away">
If You Go Away
</a>
<cite>...Been Going On?", and The Beatles' "Let It Be". The album was arranged by Larry Muhoberac, Roger Newman, Sid Feller and Ray Charles. True to Life Studio album by Ray Charles Released October 1977 Recorded 1977; R.P.M International Studios, Los Angeles, California Genre R&amp;B, soul Length 38:44 Label Atlantic Producer Ray Charles Ray Charles chronology Porgy and Bess (1976) True to Life (1977) Love &amp; Peace (1978) Professional ratings Review scores Source Rating Allmusic Christgau's Record Guide A......</cite>
<cite>...standard and has been recorded by many artists, including Greta Keller, for whom some say McKuen wrote the lyrics. "If You Go Away" Single by Damita Jo from the album If You Go Away B-side "<b>Yellow</b> Days" Released 1966 Genre Jazz Length 3:49 Label Epic Records Songwriter(s) Jacques Brel, Rod McKuen Producer(s) Bob Morgan Damita Jo singles chronology "Gotta Travel On" (1965) "If You Go Away" (1966) "Walk Away" (1967) Damita Jo reached #10 on the Adult Contemporary chart and #68 on the Billboard Hot 100 in 1966 for her version of the song. Terry Jacks recorded a version of the song which was released as a single in 1974 and reached #29 on the Adult Contemporary chart, #68 on the......</cite>
<div class="book-title">from Ray Charles</div>
<div class="informations">134 words</div>
<div class="informations">204 words</div>
)SEARCHRESULT"
},
/* pagination */ {}