Skip to content

Commit

Permalink
Require Lucy 0.6.2
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
theory committed Feb 8, 2024
1 parent 4a42dcf commit 3942e1c
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
os: [[🐧, ubuntu], [🍎, macos]] # [🪟, windows]
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' ]
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' ]
name: 🧅 Perl ${{ matrix.perl }} on ${{ matrix.os[0] }} ${{ matrix.os[1] }}
runs-on: ${{ matrix.os[1] }}-latest
steps:
Expand Down
18 changes: 12 additions & 6 deletions Build.PL
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ $class->new(
license => 'perl',
create_makefile_pl => 'traditional',
configure_requires => { 'Module::Build' => '0.4209' },
build_requires => {
'Module::Build' => '0.4209',
},
test_requires => {
'File::Path' => '2.08',
'File::Spec::Functions' => 0,
Expand All @@ -44,14 +41,23 @@ $class->new(
requires => {
'Carp' => 0,
'File::Spec' => 0,
'Lucy' => '0.2.1',
'perl' => '5.10.0',
'Lucy' => '0.6.2',
'perl' => '5.12.0',
},
meta_merge => {
resources => {
homepage => 'https://metacpan.org/dist/PGXN-API-Searcher',
bugtracker => 'https://github.com/pgxn/pgxn-api-searcher/issues/',
repository => 'https://github.com/pgxn/pgxn-api-searcher/',
}
},
prereqs => {
develop => {
requires => {
'Test::Pod' => '1.41',
'Test::Pod::Coverage' => '1.06',
'Test::Spelling' => '0.25',
},
},
},
},
)->create_build_script;
8 changes: 7 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Revision history for Perl extension PGXN-API-Searcher.

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

0.11.0 2024-02-06T23:37:09Z
- Converted the version from a v-string to a string to make
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ which is generated by PGXN::API. So if you use that module to create an API
server, you can use its index with this module. In fact, it uses *this* module
to serve the search API.

INSTALLATION
Installation
------------

To install this module, type the following:

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

* perl 5.12.0
* Lucy 0.2.1
* Lucy 0.5.2

Copyright and License
---------------------
Expand Down
82 changes: 48 additions & 34 deletions t/base.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use strict;
use warnings;
use utf8;
use Test::More tests => 37;
#use Test::More 'no_plan';
use Test::More tests => 41;
# use Test::More 'no_plan';
use Lucy::Plan::Schema;
use Lucy::Plan::FullTextType;
use Lucy::Analysis::PolyAnalyzer;
Expand Down Expand Up @@ -276,37 +276,32 @@ like delete $res->{hits}[0]{score}, qr/^\d+[.]\d+$/,
like delete $res->{hits}[1]{score}, qr/^\d+[.]\d+$/,
'Second hit score should look like a score';

TODO: {
# Hack to work around bug in Lucy 0.2.2.
local $TODO = 'Lucy 0.2.2 is broken' if Lucy->VERSION == 0.002002;

is_deeply $res, {
query => "ordered pair",
limit => 50,
offset => 0,
count => 2,
hits => [
{
abstract => "A key/value pair data type",
date => "2010-10-18T15:24:21Z",
dist => "pair",
excerpt => "This is the <strong>pair</strong> README file. Here you will find all thingds related to <strong>pair</strong>, including installation information",
user => "theory",
user_name => "David E. Wheeler",
version => "0.1.0",
},
{
abstract => "A semantic version data type",
date => "2010-10-18T15:24:21Z",
dist => "semver",
excerpt => "README for the semver distribion. Installation instructions",
user => "roger",
user_name => "Roger Davidson",
version => "2.1.3",
},
],
}, 'Should have results for simple search';
}
is_deeply $res, {
query => "ordered pair",
limit => 50,
offset => 0,
count => 2,
hits => [
{
abstract => "A key/value pair data type",
date => "2010-10-18T15:24:21Z",
dist => "pair",
excerpt => "This is the <strong>pair</strong> README file. Here you will find all thingds related to <strong>pair</strong>, including installation information",
user => "theory",
user_name => "David E. Wheeler",
version => "0.1.0",
},
{
abstract => "A semantic version data type",
date => "2010-10-18T15:24:21Z",
dist => "semver",
excerpt => "README for the semver distribion. Installation instructions",
user => "roger",
user_name => "Roger Davidson",
version => "2.1.3",
},
],
}, 'Should have results for simple search';

# Test offset.
ok $res = $search->search(
Expand Down Expand Up @@ -447,7 +442,6 @@ is_deeply $res, {
],
}, 'Should have expected structure for extensions';


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

# Regressions.
for my $spec (
# https://github.com/pgxn/pgxn-api/issues/23
{
name => 'issue 23',
query => "json%00'%7C%7CSLeeP(3)%26%26'1", # "json\0'||SLeeP(3)&&'1"
in => 'docs',
},
# https://github.com/pgxn/pgxn-api/issues/26
{
name => 'issue 26',
query => "..%00", # "..\0"
in => 'docs',
}
) {
ok $res = $search->search( query => $spec->{query}, in => $spec->{in} ),
"Search $spec->{name}";
is_deeply $res, { count => 0, hits => [], limit => 50, offset => 0, query => $spec->{query} },
"Should have empty structure for $spec->{name}";
}

0 comments on commit 3942e1c

Please sign in to comment.