https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37985

--- Comment #16 from HKS3 Tadeusz SoĊ›nierz <[email protected]> ---
Created attachment 208452
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208452&action=edit
Bug 37985: Enhance geosearch functionality

 - Support areas, not just points (MARC 034 subfields defg)
 - Embed geographic coordinates from GEOGR_NAME authority when indexing records
 - Allow bounding-box searches in geolocation queries
 - Allow sorting ES queries by geolocation. Default to closest-first for
geosearches
 - Include ES geographic area coordinates in search results

Test plan:

1. Start ktd with --search-engine es8
2. Go to OPAC
/cgi-bin/koha/opac-search.pl?advsearch=1&idx=geolocation&do=Search&q=lat%3A48.19538740833338+lng%3A16.30711931230611+distance%3A120km,
2b. Observe no results
3. Run the following fixture to add some geographic data to biblios and auths:

```
use strict;
use warnings;
use C4::Biblio;
use Koha::Biblios;

{
  my $biblionumber = 139; # "Effective Perl programming"
  my $biblio = Koha::Biblios->find($biblionumber);
  my $framework = $biblio->frameworkcode;
  my $record = $biblio->metadata->record;
  my @fields;
  $fields[0] = MARC::Field->new('034','','',
     'd' => 9.530833,
     'e' => 17.160556,
     'f' => 49.020556,
     'g' => 46.3725,
  );
  $record->append_fields(@fields);
  C4::Biblio::ModBiblio($record, $biblionumber, $framework);
}

{
  my $biblionumber = 262; # "Programming Perl"
  my $biblio = Koha::Biblios->find($biblionumber);
  my $framework = $biblio->frameworkcode;
  my $record = $biblio->metadata->record;
  my @fields;
  $fields[0] = MARC::Field->new('034','','',
      s => 48.143618,
      t => 17.108417,
  );
  $record->append_fields(@fields);
  C4::Biblio::ModBiblio($record, $biblionumber, $framework);
}

my $authid;
{
    my $record = MARC::Record->new;
    $record->append_fields(MARC::Field->new('151', '', '', a => 'Austria'));
    $record->append_fields(MARC::Field->new('034', '', '',
        'd' => 9.530833,
        'e' => 17.160556,
        'f' => 49.020556,
        'g' => 46.3725,
    ));
    $authid = C4::AuthoritiesMarc::AddAuthority($record, undef, 'GEOGR_NAME');
}

{
  my $biblionumber = 165; # "Higher-order Perl"
  my $biblio = Koha::Biblios->find($biblionumber);
  my $framework = $biblio->frameworkcode;
  my $record = $biblio->metadata->record;
  my @fields;
  $fields[0] = MARC::Field->new('651','','0',
     a => 'Austria',
     9 => $authid,
  );
  $record->append_fields(@fields);
  C4::Biblio::ModBiblio($record, $biblionumber, $framework);
}
```

4. Rebuild the elasticsearch index just in case:

    koha-elasticsearch --rebuild -r kohadev

5. Go to OPAC
/cgi-bin/koha/opac-search.pl?advsearch=1&idx=geolocation&do=Search&q=lat%3A48.19538740833338+lng%3A16.30711931230611+distance%3A120km
5b. Observe results showing up
6. Try a bounding box search:
/cgi-bin/koha/opac-search.pl?advsearch=1&idx=geolocation&do=Search&q=boundingbox%3A49.710272582105695%2C14.710709564388294%2C46.78501604269256%2C19.182145111263296
6b. Observe results again

Sponsored-by: Geosphere Austria
Signed-off-by: Arthur Suzuki <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to