Skip to content

Commit 3942e1c

Browse files
committed
Require Lucy 0.6.2
Add regression tests to ensure it no longer chokes on null bytes. Fixes pgxn/pgxn-api#23 and pgxn/pgxn-api#23. Stop skipping tests against Lucy 0.002002, which is no longer supported. Add developer dependencies and drop for Perl 5.10. Timestamp for v0.11.1.
1 parent 4a42dcf commit 3942e1c

File tree

5 files changed

+71
-44
lines changed

5 files changed

+71
-44
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
strategy:
88
matrix:
99
os: [[🐧, ubuntu], [🍎, macos]] # [🪟, windows]
10-
perl: [ '5.38', '5.36', '5.34', '5.32', '5.30', '5.28', '5.26', '5.24', '5.22', '5.20', '5.18', '5.16', '5.14', '5.12', '5.10' ]
10+
perl: [ '5.38', '5.36', '5.34', '5.32', '5.30', '5.28', '5.26', '5.24', '5.22', '5.20', '5.18', '5.16', '5.14', '5.12' ]
1111
name: 🧅 Perl ${{ matrix.perl }} on ${{ matrix.os[0] }} ${{ matrix.os[1] }}
1212
runs-on: ${{ matrix.os[1] }}-latest
1313
steps:

Build.PL

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ $class->new(
3333
license => 'perl',
3434
create_makefile_pl => 'traditional',
3535
configure_requires => { 'Module::Build' => '0.4209' },
36-
build_requires => {
37-
'Module::Build' => '0.4209',
38-
},
3936
test_requires => {
4037
'File::Path' => '2.08',
4138
'File::Spec::Functions' => 0,
@@ -44,14 +41,23 @@ $class->new(
4441
requires => {
4542
'Carp' => 0,
4643
'File::Spec' => 0,
47-
'Lucy' => '0.2.1',
48-
'perl' => '5.10.0',
44+
'Lucy' => '0.6.2',
45+
'perl' => '5.12.0',
4946
},
5047
meta_merge => {
5148
resources => {
5249
homepage => 'https://metacpan.org/dist/PGXN-API-Searcher',
5350
bugtracker => 'https://github.com/pgxn/pgxn-api-searcher/issues/',
5451
repository => 'https://github.com/pgxn/pgxn-api-searcher/',
55-
}
52+
},
53+
prereqs => {
54+
develop => {
55+
requires => {
56+
'Test::Pod' => '1.41',
57+
'Test::Pod::Coverage' => '1.06',
58+
'Test::Spelling' => '0.25',
59+
},
60+
},
61+
},
5662
},
5763
)->create_build_script;

Changes

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Revision history for Perl extension PGXN-API-Searcher.
22

3-
0.11.1
3+
0.11.1 2024-02-08T21:21:37Z
4+
- Require Lucy v0.6.2.
5+
- Added regression tests to ensure Lucy no longer chokes on null bytes
6+
in the query (pgxn/pgxn-api#23).
7+
- Restored test that skipped running to avoid a bug in Lucy 0.002002.
8+
- Added developer dependencies.
9+
- Dropped support for Perl 5.10.
410

511
0.11.0 2024-02-06T23:37:09Z
612
- Converted the version from a v-string to a string to make

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ which is generated by PGXN::API. So if you use that module to create an API
77
server, you can use its index with this module. In fact, it uses *this* module
88
to serve the search API.
99

10-
INSTALLATION
10+
Installation
11+
------------
1112

1213
To install this module, type the following:
1314

@@ -29,7 +30,7 @@ Dependencies
2930
PGXN-API-Searcher requires the following modules:
3031

3132
* perl 5.12.0
32-
* Lucy 0.2.1
33+
* Lucy 0.5.2
3334

3435
Copyright and License
3536
---------------------

t/base.t

Lines changed: 48 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
use strict;
44
use warnings;
55
use utf8;
6-
use Test::More tests => 37;
7-
#use Test::More 'no_plan';
6+
use Test::More tests => 41;
7+
# use Test::More 'no_plan';
88
use Lucy::Plan::Schema;
99
use Lucy::Plan::FullTextType;
1010
use Lucy::Analysis::PolyAnalyzer;
@@ -276,37 +276,32 @@ like delete $res->{hits}[0]{score}, qr/^\d+[.]\d+$/,
276276
like delete $res->{hits}[1]{score}, qr/^\d+[.]\d+$/,
277277
'Second hit score should look like a score';
278278

279-
TODO: {
280-
# Hack to work around bug in Lucy 0.2.2.
281-
local $TODO = 'Lucy 0.2.2 is broken' if Lucy->VERSION == 0.002002;
282-
283-
is_deeply $res, {
284-
query => "ordered pair",
285-
limit => 50,
286-
offset => 0,
287-
count => 2,
288-
hits => [
289-
{
290-
abstract => "A key/value pair data type",
291-
date => "2010-10-18T15:24:21Z",
292-
dist => "pair",
293-
excerpt => "This is the <strong>pair</strong> README file. Here you will find all thingds related to <strong>pair</strong>, including installation information",
294-
user => "theory",
295-
user_name => "David E. Wheeler",
296-
version => "0.1.0",
297-
},
298-
{
299-
abstract => "A semantic version data type",
300-
date => "2010-10-18T15:24:21Z",
301-
dist => "semver",
302-
excerpt => "README for the semver distribion. Installation instructions",
303-
user => "roger",
304-
user_name => "Roger Davidson",
305-
version => "2.1.3",
306-
},
307-
],
308-
}, 'Should have results for simple search';
309-
}
279+
is_deeply $res, {
280+
query => "ordered pair",
281+
limit => 50,
282+
offset => 0,
283+
count => 2,
284+
hits => [
285+
{
286+
abstract => "A key/value pair data type",
287+
date => "2010-10-18T15:24:21Z",
288+
dist => "pair",
289+
excerpt => "This is the <strong>pair</strong> README file. Here you will find all thingds related to <strong>pair</strong>, including installation information",
290+
user => "theory",
291+
user_name => "David E. Wheeler",
292+
version => "0.1.0",
293+
},
294+
{
295+
abstract => "A semantic version data type",
296+
date => "2010-10-18T15:24:21Z",
297+
dist => "semver",
298+
excerpt => "README for the semver distribion. Installation instructions",
299+
user => "roger",
300+
user_name => "Roger Davidson",
301+
version => "2.1.3",
302+
},
303+
],
304+
}, 'Should have results for simple search';
310305

311306
# Test offset.
312307
ok $res = $search->search(
@@ -447,7 +442,6 @@ is_deeply $res, {
447442
],
448443
}, 'Should have expected structure for extensions';
449444

450-
451445
ok $res = $search->search( query => 'Davidson', in => 'users' ), 'Seach users';
452446
like delete $res->{hits}[0]{score}, qr/^\d+[.]\d+$/,
453447
'The score should look like a score';
@@ -466,3 +460,23 @@ is_deeply $res, {
466460
],
467461
}, 'Should have expected structure for users';
468462

463+
# Regressions.
464+
for my $spec (
465+
# https://github.com/pgxn/pgxn-api/issues/23
466+
{
467+
name => 'issue 23',
468+
query => "json%00'%7C%7CSLeeP(3)%26%26'1", # "json\0'||SLeeP(3)&&'1"
469+
in => 'docs',
470+
},
471+
# https://github.com/pgxn/pgxn-api/issues/26
472+
{
473+
name => 'issue 26',
474+
query => "..%00", # "..\0"
475+
in => 'docs',
476+
}
477+
) {
478+
ok $res = $search->search( query => $spec->{query}, in => $spec->{in} ),
479+
"Search $spec->{name}";
480+
is_deeply $res, { count => 0, hits => [], limit => 50, offset => 0, query => $spec->{query} },
481+
"Should have empty structure for $spec->{name}";
482+
}

0 commit comments

Comments
 (0)