Bug 37985 - Extend geo-search to support areas, not just points (MARC 034 subfields defg)
Summary: Extend geo-search to support areas, not just points (MARC 034 subfields defg)
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching - Elasticsearch (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: HKS3 Tadeusz Sośnierz
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-23 11:31 UTC by HKS3 Tadeusz Sośnierz
Modified: 2024-09-30 19:29 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 37985: Extend geo-search to support areas, not just points (MARC 034 subfields defg) (11.23 KB, patch)
2024-09-23 12:00 UTC, HKS3 Tadeusz Sośnierz
Details | Diff | Splinter Review
Bug 37985: Extend geo-search to support areas, not just points (MARC 034 subfields defg) (7.90 KB, patch)
2024-09-23 12:34 UTC, HKS3 Tadeusz Sośnierz
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description HKS3 Tadeusz Sośnierz 2024-09-23 11:31:45 UTC
Bug 31652 ("Add geo-search") implements indexing geographic coordinates (034s,t) in Elasticsearch to enable searching for records referring to specific coordinates. Some records (or authorities) will refer to whole areas, which MARC encodes as north/south/east/westmost points. Since elasticsearch supports indexing shapes, not just points, it would be a nice improvement to be able to index this as well.
Comment 1 HKS3 Tadeusz Sośnierz 2024-09-23 12:00:13 UTC
Created attachment 171877 [details] [review]
Bug 37985: Extend geo-search to support areas, not just points (MARC 034 subfields defg)
Comment 2 HKS3 Tadeusz Sośnierz 2024-09-23 12:34:01 UTC
Created attachment 171878 [details] [review]
Bug 37985: Extend geo-search to support areas, not just points (MARC 034 subfields defg)
Comment 3 HKS3 Tadeusz Sośnierz 2024-09-23 12:36:27 UTC
Test plan:

1. Run the following code to add geolocation data to a book:

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

# Add the bounding box of Austria to a biblio
{
  my $biblionumber = 139;
  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);
}
```

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, observe no results
3. Apply the patch
4. Perform the required DB migration: `alter table search_field MODIFY COLUMN type enum('','string','date','number','boolean','sum','isbn','stdno','year','callnumber','geo_point', 'geo_shape');`
5. Rebuild the index: `koha-elasticsearch --rebuild -r kohadev`
6. Restart Koha: `koha-plack --restart kohadev`
7. Retry /cgi-bin/koha/opac-search.pl?advsearch=1&idx=geolocation&do=Search&q=lat%3A48.19538740833338+lng%3A16.30711931230611+distance%3A120km, see a result pop up.