-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds optional spatial search overlapRatio relevancy support. Configur…
…able via the presence of Settings.OVERLAP_RATIO_BOOST. When a bbox param is present, the Settings.OVERLAP_RATIO_BOOST value will boost results based on the overlap ratio of the result bboxes. Includes a modification to our Solr schema to include a _bboxtype fieldtype. Requires Solr 7.4+ Co-Authored-By: hudajkhan <hudajkhan@users.noreply.github.com>
- Loading branch information
Showing
8 changed files
with
92 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#Written by CorePropertiesLocator | ||
#name=geoblacklight #Change the name to the appropriate one you would like to use | ||
config=solrconfig.xml | ||
schema=schema.xml | ||
#dataDir=geodata #Change this directory to the appropriate one you would like to use |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
require 'spec_helper' | ||
|
||
feature 'spatial search results overlap ratio' do | ||
scenario 'result bboxes fully contained, overlap ratio applied to relevancy' do | ||
allow(Settings).to receive(:OVERLAP_RATIO_BOOST).and_return 200 | ||
|
||
# BBox param is the US upper midwest and Canada, roughly centered on the state of Minnesota | ||
visit search_catalog_path( | ||
bbox: '-103.196521 39.21962 -84.431873 53.63497', | ||
'f[dct_provenance_s][]': 'Minnesota' | ||
) | ||
|
||
# MN State result | ||
# Slightly bigger bbox / result bbox fits bbox param best | ||
expect(position_in_result_page(page, 'e9c71086-6b25-4950-8e1c-84c2794e3382')).to eq 1 | ||
|
||
# MN State result | ||
# Slightly smaller bbox / result bbox fits bbox param second best | ||
expect(position_in_result_page(page, '2eddde2f-c222-41ca-bd07-2fd74a21f4de')).to eq 2 | ||
|
||
# TC Metro result | ||
# Smaller bbox / result bbox fits bbox param third | ||
expect(position_in_result_page(page, '02236876-9c21-42f6-9870-d2562da8e44f')).to eq 3 | ||
end | ||
|
||
scenario 'three bboxes overlap, but none are fully contained, overlap ratio should still impact relevancy' do | ||
allow(Settings).to receive(:OVERLAP_RATIO_BOOST).and_return 200 | ||
|
||
# BBox param is the center to western edge of New York state and Canada, roughly centered on Lake Ontario | ||
visit search_catalog_path( | ||
bbox: '-83.750499 40.41709 -74.368175 47.963663', | ||
'f[dct_provenance_s][]': 'Cornell' | ||
) | ||
|
||
# NY State result | ||
# Bigger bbox / result bbox overlaps bbox param best | ||
expect(position_in_result_page(page, 'cugir-008186')).to be < 3 | ||
|
||
# NY State result | ||
# Bigger bbox / result bbox overlaps bbox param best (score tie) | ||
expect(position_in_result_page(page, 'cugir-008186-no-downloadurl')).to be < 3 | ||
|
||
# NY Adirondak Region result | ||
# Smaller bbox / result bbox overlaps bbox param the least | ||
expect(position_in_result_page(page, 'cugir-007741')).to eq 3 | ||
end | ||
end | ||
|
||
def position_in_result_page(page, id) | ||
results = [] | ||
page.all('div.documentHeader.row').each do |div| | ||
results << div['data-layer-id'] | ||
end | ||
results.index(id) + 1 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters