blacklight_range_limit 7.0.1 → 7.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +25 -0
- data/Gemfile +6 -2
- data/README.md +42 -44
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight_range_limit/range_limit_distro_facets.js +5 -5
- data/app/assets/javascripts/blacklight_range_limit/range_limit_slider.js +5 -25
- data/app/assets/javascripts/blacklight_range_limit.js +3 -1
- data/app/views/blacklight_range_limit/_range_limit_panel.html.erb +7 -9
- data/blacklight_range_limit.gemspec +5 -8
- data/lib/blacklight_range_limit/engine.rb +0 -2
- data/lib/generators/blacklight_range_limit/assets_generator.rb +0 -3
- data/lib/generators/blacklight_range_limit/install_generator.rb +14 -2
- data/lib/generators/blacklight_range_limit/templates/search_history_controller.rb +1 -0
- data/solr/conf/schema.xml +15 -0
- data/solr/conf/solrconfig.xml +0 -1
- data/spec/features/blacklight_range_limit_spec.rb +4 -4
- data/spec/features/javascript_spec.rb +11 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/test_app_templates/Gemfile.extra +1 -2
- metadata +18 -57
- data/.github/workflows/ruby.yml +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcbdbc78c473e59d57bd6453adf5f6c09eec1786f5a537b57b53077a736602c8
|
4
|
+
data.tar.gz: 0eccabe9cd9231a0cb62d80d470762a056881aa93e34ea655a28268369d034ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34088b2dab05fb33d092fca7b4e407e8d0418e4531995c58fc3371da00ff7dd1a27bb6d4e2a52ecb47ed27309ca586befb24ae52c03ce4d3e3e10793a2cade13
|
7
|
+
data.tar.gz: a6f1480b8b63f8ba8f1a2bed53518f45f9dca2efe42f73ff92af2553814650f25d74e46fc2c07222f7225afa06c9da287fa6f158c2d47041dc0019df103872de
|
data/.travis.yml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
notifications:
|
2
|
+
email: false
|
3
|
+
|
4
|
+
addons:
|
5
|
+
chrome: stable
|
6
|
+
|
7
|
+
language: ruby
|
8
|
+
sudo: false
|
9
|
+
rvm:
|
10
|
+
- 2.5.5
|
11
|
+
|
12
|
+
before_install:
|
13
|
+
- gem install bundler
|
14
|
+
- google-chrome-stable --headless --no-sandbox --disable-gpu --remote-debugging-port=9222 http://localhost &
|
15
|
+
|
16
|
+
|
17
|
+
notifications:
|
18
|
+
irc: "irc.freenode.org#blacklight"
|
19
|
+
email:
|
20
|
+
- blacklight-commits@googlegroups.com
|
21
|
+
|
22
|
+
global_env:
|
23
|
+
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
24
|
+
|
25
|
+
jdk: oraclejdk8
|
data/Gemfile
CHANGED
@@ -27,8 +27,12 @@ else
|
|
27
27
|
end
|
28
28
|
|
29
29
|
case ENV['RAILS_VERSION']
|
30
|
-
when /^
|
31
|
-
gem '
|
30
|
+
when /^4.2/
|
31
|
+
gem 'responders', '~> 2.0'
|
32
|
+
gem 'sass-rails', '>= 5.0'
|
33
|
+
gem 'coffee-rails', '~> 4.1.0'
|
34
|
+
when /^4.[01]/
|
35
|
+
gem 'sass-rails', '< 5.0'
|
32
36
|
end
|
33
37
|
end
|
34
38
|
# END ENGINE_CART BLOCK
|
data/README.md
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
BlacklightRangeLimit: integer range limiting and profiling for Blacklight applications
|
2
2
|
|
3
|
-
![Build Status](https://
|
3
|
+
[![Build Status](https://travis-ci.org/projectblacklight/blacklight_range_limit.png?branch=v5.0.0)](https://travis-ci.org/projectblacklight/blacklight_range_limit) [![Gem Version](https://badge.fury.io/rb/blacklight_range_limit.png)](http://badge.fury.io/rb/blacklight_range_limit)
|
4
4
|
|
5
5
|
![Screen shot](doc/example-screenshot.png)
|
6
6
|
|
7
7
|
# Description
|
8
8
|
|
9
|
-
The BlacklightRangeLimit plugin provides a 'facet' or limit for integer fields, that lets the user enter range limits with a text box or a slider, and also provides area charts giving a sense of the distribution of values (with drill down).
|
9
|
+
The BlacklightRangeLimit plugin provides a 'facet' or limit for integer fields, that lets the user enter range limits with a text box or a slider, and also provides area charts giving a sense of the distribution of values (with drill down).
|
10
10
|
|
11
|
-
The primary use case of this plugin is for 'year' data, but it should work for any integer field. It may not work right for negative numbers, however.
|
11
|
+
The primary use case of this plugin is for 'year' data, but it should work for any integer field. It may not work right for negative numbers, however.
|
12
12
|
|
13
|
-
Decimal numbers and Dates are NOT supported; they theoretically could be in the future, although it gets tricky.
|
13
|
+
Decimal numbers and Dates are NOT supported; they theoretically could be in the future, although it gets tricky.
|
14
14
|
|
15
15
|
|
16
16
|
# Requirements
|
17
17
|
|
18
|
-
A Solr integer field. Depending on your data, it may or may not be advantageous to use a tint (trie with non-zero precision) type field.
|
18
|
+
A Solr integer field. Depending on your data, it may or may not be advantageous to use a tint (trie with non-zero precision) type field.
|
19
19
|
|
20
20
|
## Note on solr field types
|
21
21
|
|
22
|
-
If all your integers are the same number of digits, you can use just about any solr type, including string/type, and all will be well. But if your integers vary in digits, strings won't sort correctly, making your numbers behave oddly in partitions and limits. This is also true if you use a pre-1.4 "integer"/pint/solr.IntField field -- these are not "sortable".
|
22
|
+
If all your integers are the same number of digits, you can use just about any solr type, including string/type, and all will be well. But if your integers vary in digits, strings won't sort correctly, making your numbers behave oddly in partitions and limits. This is also true if you use a pre-1.4 "integer"/pint/solr.IntField field -- these are not "sortable".
|
23
23
|
|
24
|
-
You need to use a "sortable" numeric-type field. In Solr 1.4, the standard "int"/solr.TrieIntField should work fine and is probably prefered. For some distributions of data, it may be more efficient to use "tint" (solr.TrieIntField with non-zero precision).
|
24
|
+
You need to use a "sortable" numeric-type field. In Solr 1.4, the standard "int"/solr.TrieIntField should work fine and is probably prefered. For some distributions of data, it may be more efficient to use "tint" (solr.TrieIntField with non-zero precision).
|
25
25
|
|
26
|
-
The pre Solr 1.4 now deprecated sint or slong types should work fine too.
|
26
|
+
The pre Solr 1.4 now deprecated sint or slong types should work fine too.
|
27
27
|
|
28
28
|
# Installation
|
29
29
|
|
@@ -33,9 +33,9 @@ Add
|
|
33
33
|
|
34
34
|
gem "blacklight_range_limit"
|
35
35
|
|
36
|
-
to your Gemfile. Run "bundle install".
|
36
|
+
to your Gemfile. Run "bundle install".
|
37
37
|
|
38
|
-
Then run
|
38
|
+
Then run
|
39
39
|
|
40
40
|
rails generate blacklight_range_limit:install
|
41
41
|
|
@@ -46,43 +46,43 @@ This will install some asset references in your application.js and application.c
|
|
46
46
|
You have at least one solr field you want to display as a range limit, that's why you've installed this plugin. In your CatalogController, the facet configuration should look like:
|
47
47
|
|
48
48
|
```ruby
|
49
|
-
config.add_facet_field 'pub_date', label: 'Publication Year', range: true
|
49
|
+
config.add_facet_field 'pub_date', label: 'Publication Year', range: true
|
50
50
|
```
|
51
|
-
|
52
|
-
You should now get range limit display. More complicated configuration is available if desired, see Range Facet Configuration below.
|
51
|
+
|
52
|
+
You should now get range limit display. More complicated configuration is available if desired, see Range Facet Configuration below.
|
53
53
|
|
54
54
|
|
55
55
|
You can also configure the look and feel of the Flot chart using the jQuery .data() method. On the `.facet_limit` container you want to configure, add a Flot options associative array (documented at http://people.iola.dk/olau/flot/API.txt) as the `plot-config` key. The `plot-config` key to set the `plot-config` key on the appropriate `.facet_limit` container. In order to customize the plot colors, for example, you could use this code:
|
56
56
|
|
57
57
|
```javascript
|
58
|
-
$('.blacklight-year_i').data('plot-config', {
|
59
|
-
selection: { color: '#C0FF83' },
|
60
|
-
colors: ['#ffffff'],
|
61
|
-
series: { lines: { fillColor: 'rgba(255,255,255, 0.5)' }},
|
62
|
-
grid: { color: '#aaaaaa', tickColor: '#aaaaaa', borderWidth: 0 }
|
58
|
+
$('.blacklight-year_i').data('plot-config', {
|
59
|
+
selection: { color: '#C0FF83' },
|
60
|
+
colors: ['#ffffff'],
|
61
|
+
series: { lines: { fillColor: 'rgba(255,255,255, 0.5)' }},
|
62
|
+
grid: { color: '#aaaaaa', tickColor: '#aaaaaa', borderWidth: 0 }
|
63
63
|
});
|
64
64
|
```
|
65
65
|
You can add this configuration in app/assets/javascript/application.js, or anywhere else loaded before the blacklight range limit javascript.
|
66
66
|
|
67
67
|
## A note on AJAX use
|
68
68
|
|
69
|
-
In order to calculate distribution segment ranges, we need to first know the min and max boundaries. But we don't really know that until we've fetched the result set (we use the Solr Stats component to get min and max with a result set).
|
69
|
+
In order to calculate distribution segment ranges, we need to first know the min and max boundaries. But we don't really know that until we've fetched the result set (we use the Solr Stats component to get min and max with a result set).
|
70
70
|
|
71
|
-
So, ordinarily, after we've gotten the result set, only then can we calculate the segment ranges, and then we need to do another Solr request to actually fetch the segment range counts.
|
71
|
+
So, ordinarily, after we've gotten the result set, only then can we calculate the segment ranges, and then we need to do another Solr request to actually fetch the segment range counts.
|
72
72
|
|
73
|
-
The plugin uses an AJAX request on the result page to do this. This means that for every application results display that includes any values at all in your range field, your application will get a second AJAX http request, and make a second solr request.
|
73
|
+
The plugin uses an AJAX request on the result page to do this. This means that for every application results display that includes any values at all in your range field, your application will get a second AJAX http request, and make a second solr request.
|
74
74
|
|
75
|
-
If you'd like to avoid this, you can turn off segment display altogether with the :segment option below; or you can set :assumed_boundaries below to use fixed boundaries for not-yet-limited segments instead of taking boundaries from the result set.
|
75
|
+
If you'd like to avoid this, you can turn off segment display altogether with the :segment option below; or you can set :assumed_boundaries below to use fixed boundaries for not-yet-limited segments instead of taking boundaries from the result set.
|
76
76
|
|
77
77
|
Note that a drill-down will never require the second request, because boundaries on a drill-down are always taken from the specified limits.
|
78
78
|
|
79
|
-
|
79
|
+
|
80
80
|
## Range Facet Configuration
|
81
81
|
|
82
|
-
Instead of simply passing "true", you can pass a hash with additional configuration. Here's an example with all the available keys, you don't need to use them all, just the ones you want to set to non-default values.
|
82
|
+
Instead of simply passing "true", you can pass a hash with additional configuration. Here's an example with all the available keys, you don't need to use them all, just the ones you want to set to non-default values.
|
83
83
|
|
84
84
|
```ruby
|
85
|
-
config.add_facet_field 'pub_date', label: 'Publication Year',
|
85
|
+
config.add_facet_field 'pub_date', label: 'Publication Year',
|
86
86
|
range: {
|
87
87
|
num_segments: 6,
|
88
88
|
assumed_boundaries: [1100, Time.now.year + 2],
|
@@ -92,31 +92,29 @@ config.add_facet_field 'pub_date', label: 'Publication Year',
|
|
92
92
|
```
|
93
93
|
|
94
94
|
* **:num_segments** :
|
95
|
-
* Default 10. Approximately how many segments to divide the range into for segment facets, which become segments on the chart. Actual segments are calculated to be 'nice' values, so may not exactly match your setting.
|
95
|
+
* Default 10. Approximately how many segments to divide the range into for segment facets, which become segments on the chart. Actual segments are calculated to be 'nice' values, so may not exactly match your setting.
|
96
96
|
* **:assumed_boundaries** :
|
97
|
-
* Default null. For a result set that has not yet been limited, instead of taking boundaries from results and making a second AJAX request to fetch segments, just assume these given boundaries. If you'd like to avoid this second AJAX Solr call, you can set :assumed_boundaries to a two-element array of integers instead, and the assumed boundaries will always be used. Note this is live ruby code, you can put calculations in there like Time.now.year + 2.
|
97
|
+
* Default null. For a result set that has not yet been limited, instead of taking boundaries from results and making a second AJAX request to fetch segments, just assume these given boundaries. If you'd like to avoid this second AJAX Solr call, you can set :assumed_boundaries to a two-element array of integers instead, and the assumed boundaries will always be used. Note this is live ruby code, you can put calculations in there like Time.now.year + 2.
|
98
98
|
* **:segments** :
|
99
|
-
* Default true. If set to false, then distribution segment facets will not be loaded at all.
|
99
|
+
* Default true. If set to false, then distribution segment facets will not be loaded at all.
|
100
100
|
* **:maxlength** :
|
101
101
|
* Default 4. Changes the value of the `maxlength` attribute of the text boxes, which determines how many digits can be entered.
|
102
|
-
|
103
|
-
## Javascript dependencies
|
104
102
|
|
105
|
-
|
103
|
+
## Javascript dependencies
|
106
104
|
|
107
|
-
|
105
|
+
The selectable histograms/barcharts are done with Javascript, using [Flot](http://code.google.com/p/flot/). Flot requires JQuery, as well as support for the HTML5 canvas element. In IE previous to IE9, canvas element support can be added with [excanvas](http://excanvas.sourceforge.net/). For the slider, [bootstrap-slider](http://www.eyecon.ro/bootstrap-slider/) is used (bootstrap-slider is actually third party, not officially bootstrap). Flot and bootstrap-slider are both directly included in blacklight_range_limit in vendor, rather than referenced as dependencies.
|
108
106
|
|
109
|
-
|
107
|
+
The blacklight_range_limit installer will add `require 'blacklight_range_limit'` to your `application.js` sprockets manifest. This will include flot, bootstrap-slider, and the blacklight_range_limit glue JS.
|
110
108
|
|
111
|
-
|
109
|
+
Both flot and blacklight_range_limit's own JS depend on JQuery; the host app is expected to include JQuery; a default Blacklight-generated app already does. (Jquery 1, 2, or 3 should work)
|
112
110
|
|
113
|
-
If you don't want any of this gem's JS, you can simply remove the `require 'blacklight_range_limit'` line from your application.js, and hack something else together yourself.
|
111
|
+
If you don't want any of this gem's JS, you can simply remove the `require 'blacklight_range_limit'` line from your application.js, and hack something else together yourself.
|
114
112
|
|
115
113
|
## IE8, excanvas
|
116
114
|
|
117
|
-
IE8 and below do not support the 'canvas' element, needed for flot to render the chart.
|
115
|
+
IE8 and below do not support the 'canvas' element, needed for flot to render the chart.
|
118
116
|
Without canvas, view will cleanly degrade to an ordinary textual listing of range segments
|
119
|
-
as facets.
|
117
|
+
as facets.
|
120
118
|
|
121
119
|
Or, you can use excanvas.js to add canvas support to IE. `blacklight_range_limit` includes
|
122
120
|
the `excanvas.js` file, but you'll have to manually add a reference to it to your Rails layout
|
@@ -130,17 +128,17 @@ local custom layout instead. Then add this to the html `<head>` section:
|
|
130
128
|
For touch screens, one wants the UI to work well. The slider used is
|
131
129
|
[bootstrap_slider](http://www.eyecon.ro/bootstrap-slider/), which says if you add
|
132
130
|
Modernizr to your page, touch events will be supported. We haven't tested it
|
133
|
-
ourselves yet.
|
131
|
+
ourselves yet.
|
134
132
|
|
135
133
|
Also not sure how well the flot select UI works on a touch screen. The slider
|
136
|
-
is probably the best touch UI anyway, if it can be made to work well.
|
134
|
+
is probably the best touch UI anyway, if it can be made to work well.
|
137
135
|
|
138
136
|
# Tests
|
139
137
|
|
140
138
|
Test coverage is not great, but there are some tests, using rspec. Run `bundle exec rake ci` or just `bundle exec rake` to seed and
|
141
|
-
start a demo jetty server, build a clean test app, and run tests.
|
139
|
+
start a demo jetty server, build a clean test app, and run tests.
|
142
140
|
|
143
|
-
Just `bundle exec rake spec` to just run tests against an existing test app and jetty server.
|
141
|
+
Just `bundle exec rake spec` to just run tests against an existing test app and jetty server.
|
144
142
|
|
145
143
|
## Local Testing
|
146
144
|
If you want to iterate on a test locally and do not want to rebuild the
|
@@ -159,7 +157,7 @@ Once you are done iterating on your test you will need to stop the application s
|
|
159
157
|
|
160
158
|
# Possible future To Do
|
161
159
|
|
162
|
-
* StatsComponent replacement. We use StatsComponent to get min/max of result set, as well as missing count. StatsComponent is included on every non-drilldown request, so ranges and slider can be displayed. However, StatsComponent really can slow down the solr response with a large result set. So replace StatsComponent with other strategies. No ideal ones, we can use facet.missing to get missing count instead, but RSolr makes it harder than it should be to grab this info. We can use seperate solr queries to get min/max (sort on our field, asc and desc), but this is more complicated, more solr queries, and possibly requires redesign of AJAXy stuff, so even a lone slider can have min/max.
|
160
|
+
* StatsComponent replacement. We use StatsComponent to get min/max of result set, as well as missing count. StatsComponent is included on every non-drilldown request, so ranges and slider can be displayed. However, StatsComponent really can slow down the solr response with a large result set. So replace StatsComponent with other strategies. No ideal ones, we can use facet.missing to get missing count instead, but RSolr makes it harder than it should be to grab this info. We can use seperate solr queries to get min/max (sort on our field, asc and desc), but this is more complicated, more solr queries, and possibly requires redesign of AJAXy stuff, so even a lone slider can have min/max.
|
163
161
|
* tests
|
164
|
-
* In cases where an AJAX request is needed to fetch more results, don't trigger the AJAX until the range facet has actually been opened/shown. Currently it's done on page load.
|
165
|
-
* If :assumed_boundaries ends up popular, we could provide a method to fetch min and max values from entire corpus on app startup or in a rake task, and automatically use these as :assumed_boundaries.
|
162
|
+
* In cases where an AJAX request is needed to fetch more results, don't trigger the AJAX until the range facet has actually been opened/shown. Currently it's done on page load.
|
163
|
+
* If :assumed_boundaries ends up popular, we could provide a method to fetch min and max values from entire corpus on app startup or in a rake task, and automatically use these as :assumed_boundaries.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.0
|
1
|
+
7.1.0
|
@@ -232,24 +232,24 @@ Blacklight.onLoad(function() {
|
|
232
232
|
|
233
233
|
var slider_placeholder = $(container).closest(".limit_content").find("[data-slider-placeholder]");
|
234
234
|
if (slider_placeholder) {
|
235
|
-
slider_placeholder.slider("setValue", [from, to]);
|
235
|
+
slider_placeholder.slider("setValue", [from, to+1]);
|
236
236
|
}
|
237
237
|
}
|
238
238
|
});
|
239
239
|
|
240
240
|
var form = $(container).closest(".limit_content").find("form.range_limit");
|
241
|
-
form.find("input.range_begin, input.range_end").
|
242
|
-
|
241
|
+
form.find("input.range_begin, input.range_end").change(function () {
|
242
|
+
plot.setSelection( form_selection(form, min, max) , true );
|
243
243
|
});
|
244
244
|
$(container).closest(".limit_content").find(".profile .range").on("slide", function(event, ui) {
|
245
245
|
var values = $(event.target).data("slider").getValue();
|
246
246
|
form.find("input.range_begin").val(values[0]);
|
247
247
|
form.find("input.range_end").val(values[1]);
|
248
|
-
plot.setSelection( normalized_selection(values[0], Math.max(values[0], values[1])), true);
|
248
|
+
plot.setSelection( normalized_selection(values[0], Math.max(values[0], values[1]-1)), true);
|
249
249
|
});
|
250
250
|
|
251
251
|
// initially entirely selected, to match slider
|
252
|
-
plot.setSelection(
|
252
|
+
plot.setSelection( {xaxis: { from:min, to:max+0.9999}} );
|
253
253
|
}
|
254
254
|
}
|
255
255
|
|
@@ -23,8 +23,8 @@ $(".range_limit .profile .range.slider_js").each(function() {
|
|
23
23
|
if (placeholder_input.slider !== undefined) {
|
24
24
|
placeholder_input.slider({
|
25
25
|
min: min,
|
26
|
-
max: max,
|
27
|
-
value: [min, max],
|
26
|
+
max: max+1,
|
27
|
+
value: [min, max+1],
|
28
28
|
tooltip: "hide"
|
29
29
|
});
|
30
30
|
|
@@ -57,7 +57,7 @@ $(".range_limit .profile .range.slider_js").each(function() {
|
|
57
57
|
begin_el.val(min);
|
58
58
|
end_el.val(max);
|
59
59
|
|
60
|
-
begin_el.
|
60
|
+
begin_el.change( function() {
|
61
61
|
var val = BlacklightRangeLimit.parseNum($(this).val());
|
62
62
|
if ( isNaN(val) || val < min) {
|
63
63
|
//for weird data, set slider at min
|
@@ -68,7 +68,7 @@ $(".range_limit .profile .range.slider_js").each(function() {
|
|
68
68
|
placeholder_input.slider("setValue", values);
|
69
69
|
});
|
70
70
|
|
71
|
-
end_el.
|
71
|
+
end_el.change( function() {
|
72
72
|
var val = BlacklightRangeLimit.parseNum($(this).val());
|
73
73
|
if ( isNaN(val) || val > max ) {
|
74
74
|
//weird entry, set slider to max
|
@@ -77,27 +77,7 @@ $(".range_limit .profile .range.slider_js").each(function() {
|
|
77
77
|
var values = placeholder_input.data("slider").getValue();
|
78
78
|
values[1] = val;
|
79
79
|
placeholder_input.slider("setValue", values);
|
80
|
-
});
|
81
|
-
|
82
|
-
begin_el.change(function() {
|
83
|
-
var val1 = BlacklightRangeLimit.parseNum(begin_el.val());
|
84
|
-
var val2 = BlacklightRangeLimit.parseNum(end_el.val());
|
85
|
-
|
86
|
-
if (val2 < val1) {
|
87
|
-
begin_el.val(val2);
|
88
|
-
end_el.val(val1);
|
89
|
-
}
|
90
|
-
});
|
91
|
-
|
92
|
-
end_el.change(function() {
|
93
|
-
var val1 = BlacklightRangeLimit.parseNum(begin_el.val());
|
94
|
-
var val2 = BlacklightRangeLimit.parseNum(end_el.val());
|
95
|
-
|
96
|
-
if (val2 < val1) {
|
97
|
-
begin_el.val(val2);
|
98
|
-
end_el.val(val1);
|
99
|
-
}
|
100
|
-
});
|
80
|
+
});
|
101
81
|
|
102
82
|
});
|
103
83
|
|
@@ -1,8 +1,10 @@
|
|
1
1
|
// Master manifest file for engine, so local app can require
|
2
2
|
// this one file, but get all our files -- and local app
|
3
3
|
// require does not need to change if we change file list.
|
4
|
+
//
|
5
|
+
// Note JQuery is required to be loaded for flot and blacklight_range_limit
|
6
|
+
// JS to work, expect host app to load it.
|
4
7
|
|
5
|
-
//= require 'jquery'
|
6
8
|
|
7
9
|
//= require 'flot/jquery.flot.js'
|
8
10
|
//= require 'flot/jquery.flot.selection.js'
|
@@ -13,10 +13,10 @@
|
|
13
13
|
<li class="selected">
|
14
14
|
<span class="facet-label">
|
15
15
|
<span class="selected"><%= range_display(field_name) %></span>
|
16
|
-
|
17
|
-
<span class="
|
16
|
+
<%= link_to remove_range_param(field_name), :class=>"remove", :title => t('blacklight.range_limit.remove_limit') do %>
|
17
|
+
<span class="remove-icon">✖</span>
|
18
18
|
<span class="sr-only">[<%= t('blacklight.range_limit.remove_limit') %>]</span>
|
19
|
-
|
19
|
+
<% end %>
|
20
20
|
</span>
|
21
21
|
<span class="selected facet-count"><%= number_with_delimiter(@response.total) %></span>
|
22
22
|
</li>
|
@@ -51,7 +51,7 @@
|
|
51
51
|
|
52
52
|
<% if (min = range_results_endpoint(field_name, :min)) &&
|
53
53
|
(max = range_results_endpoint(field_name, :max)) %>
|
54
|
-
<p class="range subsection <%= "slider_js" unless field_config[:slider_js] == false
|
54
|
+
<p class="range subsection <%= "slider_js" unless field_config[:slider_js] == false %>">
|
55
55
|
Current results range from <span class="min"><%= range_results_endpoint(field_name, :min) %></span> to <span class="max"><%= range_results_endpoint(field_name, :max) %></span>
|
56
56
|
</p>
|
57
57
|
|
@@ -71,17 +71,15 @@
|
|
71
71
|
<% end %>
|
72
72
|
<% end %>
|
73
73
|
|
74
|
-
|
75
|
-
|
76
74
|
<% if (stats = stats_for_field(field_name)) && stats["missing"] > 0 %>
|
77
75
|
<ul class="missing list-unstyled facet-values subsection">
|
78
76
|
<li>
|
79
77
|
<span class="facet-label">
|
80
78
|
<%= link_to BlacklightRangeLimit.labels[:missing], add_range_missing(field_name) %>
|
81
79
|
</span>
|
82
|
-
|
83
|
-
|
84
|
-
|
80
|
+
<%# note important there be no whitespace inside facet-count to avoid
|
81
|
+
bug in some versions of Blacklight (including 7.1.0.alpha) %>
|
82
|
+
<span class="facet-count"><%= number_with_delimiter(stats["missing"]) %></span>
|
85
83
|
</li>
|
86
84
|
</ul>
|
87
85
|
<% end %>
|
@@ -18,18 +18,15 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.license = 'Apache 2.0'
|
19
19
|
|
20
20
|
s.add_dependency 'rails', '>= 3.0'
|
21
|
-
s.add_dependency '
|
22
|
-
s.add_dependency 'blacklight'
|
23
|
-
s.add_dependency 'tether-rails'
|
21
|
+
s.add_dependency 'blacklight', '>= 7.0'
|
24
22
|
|
25
23
|
s.add_development_dependency 'rspec', '~> 3.0'
|
26
24
|
s.add_development_dependency 'rspec-rails'
|
27
25
|
s.add_development_dependency 'capybara'
|
28
26
|
s.add_development_dependency 'sqlite3'
|
29
27
|
s.add_development_dependency 'launchy'
|
30
|
-
s.add_development_dependency 'solr_wrapper'
|
31
|
-
s.add_development_dependency 'engine_cart', '~> 2.
|
32
|
-
s.add_development_dependency 'selenium-webdriver', '
|
33
|
-
s.add_development_dependency 'webdrivers'
|
34
|
-
s.add_development_dependency 'rexml' # pending https://github.com/SeleniumHQ/selenium/issues/9001
|
28
|
+
s.add_development_dependency 'solr_wrapper', '~> 0.14'
|
29
|
+
s.add_development_dependency 'engine_cart', '~> 2.0'
|
30
|
+
s.add_development_dependency 'selenium-webdriver', '~> 3.12.0'
|
31
|
+
s.add_development_dependency 'webdrivers'
|
35
32
|
end
|
@@ -16,7 +16,7 @@ module BlacklightRangeLimit
|
|
16
16
|
|
17
17
|
def install_search_builder
|
18
18
|
path = 'app/models/search_builder.rb'
|
19
|
-
if File.
|
19
|
+
if File.exist? path
|
20
20
|
inject_into_file path, after: /include Blacklight::Solr::SearchBuilderBehavior.*$/ do
|
21
21
|
"\n include BlacklightRangeLimit::RangeLimitBuilder\n"
|
22
22
|
end
|
@@ -25,8 +25,20 @@ module BlacklightRangeLimit
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
# Adds range limit behavior to search history controller
|
28
29
|
def install_search_history_controller
|
29
|
-
|
30
|
+
path = 'app/controllers/search_history_controller.rb'
|
31
|
+
|
32
|
+
# If local copy of search history controller exists, add range limit helpers
|
33
|
+
if File.exist? path
|
34
|
+
inject_into_file path, after: /include Blacklight::SearchHistory.*$/ do
|
35
|
+
"\n helper BlacklightRangeLimit::ViewHelperOverride"\
|
36
|
+
"\n helper RangeLimitHelper"
|
37
|
+
end
|
38
|
+
# Otherwise copies search history controller to application
|
39
|
+
else
|
40
|
+
copy_file 'search_history_controller.rb', path
|
41
|
+
end
|
30
42
|
end
|
31
43
|
|
32
44
|
def install_routing_concern
|
data/solr/conf/schema.xml
CHANGED
@@ -175,6 +175,16 @@
|
|
175
175
|
<dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false" />
|
176
176
|
|
177
177
|
|
178
|
+
<!-- location (_ll...) -->
|
179
|
+
|
180
|
+
<dynamicField name="*_lli" type="location" stored="false" indexed="true" multiValued="false"/>
|
181
|
+
<dynamicField name="*_llim" type="location" stored="false" indexed="true" multiValued="true"/>
|
182
|
+
|
183
|
+
<dynamicField name="*_lls" type="location" stored="true" indexed="false" multiValued="false"/>
|
184
|
+
<dynamicField name="*_llsm" type="location" stored="true" indexed="false" multiValued="true"/>
|
185
|
+
<dynamicField name="*_llsi" type="location" stored="true" indexed="true" multiValued="false"/>
|
186
|
+
<dynamicField name="*_llsim" type="location" stored="true" indexed="true" multiValued="true"/>
|
187
|
+
|
178
188
|
<dynamicField name="*_srpt" type="location_rpt" stored="true" indexed="true" multiValued="true" />
|
179
189
|
<dynamicField name="*_bbox" type="bbox" stored="true" indexed="true" />
|
180
190
|
|
@@ -253,6 +263,9 @@
|
|
253
263
|
-->
|
254
264
|
<fieldType name="point" class="solr.PointType" dimension="2" subFieldSuffix="_d"/>
|
255
265
|
|
266
|
+
<!-- A specialized field for geospatial search. If indexed, this fieldType must not be multivalued. -->
|
267
|
+
<fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
|
268
|
+
|
256
269
|
<!-- An alternative geospatial field type new to Solr 4. It supports multiValued and polygon shapes.
|
257
270
|
For more information about this and other Spatial fields new to Solr 4, see:
|
258
271
|
http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4
|
@@ -337,6 +350,7 @@
|
|
337
350
|
<analyzer>
|
338
351
|
<tokenizer class="solr.StandardTokenizerFactory"/>
|
339
352
|
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
|
353
|
+
<filter class="solr.StandardFilterFactory"/>
|
340
354
|
<filter class="solr.LowerCaseFilterFactory"/>
|
341
355
|
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
|
342
356
|
</analyzer>
|
@@ -345,6 +359,7 @@
|
|
345
359
|
<fieldType name="textSuggest" class="solr.TextField" positionIncrementGap="100">
|
346
360
|
<analyzer>
|
347
361
|
<tokenizer class="solr.KeywordTokenizerFactory"/>
|
362
|
+
<filter class="solr.StandardFilterFactory"/>
|
348
363
|
<filter class="solr.LowerCaseFilterFactory"/>
|
349
364
|
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
|
350
365
|
</analyzer>
|
data/solr/conf/solrconfig.xml
CHANGED
@@ -19,7 +19,6 @@
|
|
19
19
|
<!-- solr lib dirs -->
|
20
20
|
<lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lib" />
|
21
21
|
<lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lucene-libs" />
|
22
|
-
<lib dir="${solr.install.dir:../../../..}/modules/analysis-extras/lib" />
|
23
22
|
|
24
23
|
<dataDir>${solr.data.dir:}</dataDir>
|
25
24
|
|
@@ -24,7 +24,7 @@ describe "Blacklight Range Limit" do
|
|
24
24
|
click_link 'View distribution'
|
25
25
|
click_link '2000 to 2008'
|
26
26
|
|
27
|
-
expect(page).to have_content "2000 to 2008 [remove] 12"
|
27
|
+
expect(page).to have_content "2000 to 2008 ✖ [remove] 12"
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should not include page parameter" do
|
@@ -61,9 +61,9 @@ describe "Blacklight Range Limit with configured input labels" do
|
|
61
61
|
maxlength: 6
|
62
62
|
}
|
63
63
|
config.default_solr_params[:'facet.field'] = config.facet_fields.keys
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
67
|
it "should show the range limit facet with configured labels and maxlength" do
|
68
68
|
visit '/catalog'
|
69
69
|
expect(page).to have_selector 'label.sr-only[for="range_pub_date_si_begin"]', :text => 'from publication date'
|
data/spec/spec_helper.rb
CHANGED
@@ -5,6 +5,9 @@ EngineCart.load_application!
|
|
5
5
|
|
6
6
|
require 'rspec/rails'
|
7
7
|
require 'capybara/rspec'
|
8
|
+
require 'selenium-webdriver'
|
9
|
+
|
10
|
+
Capybara.javascript_driver = :selenium_chrome_headless
|
8
11
|
|
9
12
|
RSpec.configure do |config|
|
10
13
|
# rspec-rails 3 will no longer automatically infer an example group's spec type
|
@@ -1,2 +1 @@
|
|
1
|
-
gem '
|
2
|
-
gem 'blacklight', ENV['BLACKLIGHT_VERSION'] if ENV['BLACKLIGHT_VERSION']
|
1
|
+
gem 'blacklight', github: 'projectblacklight/blacklight', branch: 'master'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight_range_limit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0
|
4
|
+
version: 7.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Rochkind
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-05-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -25,48 +25,20 @@ dependencies:
|
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '3.0'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: jquery-rails
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
35
|
-
type: :runtime
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '0'
|
42
28
|
- !ruby/object:Gem::Dependency
|
43
29
|
name: blacklight
|
44
30
|
requirement: !ruby/object:Gem::Requirement
|
45
31
|
requirements:
|
46
32
|
- - ">="
|
47
33
|
- !ruby/object:Gem::Version
|
48
|
-
version: '0'
|
34
|
+
version: '7.0'
|
49
35
|
type: :runtime
|
50
36
|
prerelease: false
|
51
37
|
version_requirements: !ruby/object:Gem::Requirement
|
52
38
|
requirements:
|
53
39
|
- - ">="
|
54
40
|
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: tether-rails
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '0'
|
63
|
-
type: :runtime
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ">="
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
41
|
+
version: '7.0'
|
70
42
|
- !ruby/object:Gem::Dependency
|
71
43
|
name: rspec
|
72
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -141,60 +113,46 @@ dependencies:
|
|
141
113
|
name: solr_wrapper
|
142
114
|
requirement: !ruby/object:Gem::Requirement
|
143
115
|
requirements:
|
144
|
-
- - "
|
116
|
+
- - "~>"
|
145
117
|
- !ruby/object:Gem::Version
|
146
|
-
version: '0'
|
118
|
+
version: '0.14'
|
147
119
|
type: :development
|
148
120
|
prerelease: false
|
149
121
|
version_requirements: !ruby/object:Gem::Requirement
|
150
122
|
requirements:
|
151
|
-
- - "
|
123
|
+
- - "~>"
|
152
124
|
- !ruby/object:Gem::Version
|
153
|
-
version: '0'
|
125
|
+
version: '0.14'
|
154
126
|
- !ruby/object:Gem::Dependency
|
155
127
|
name: engine_cart
|
156
128
|
requirement: !ruby/object:Gem::Requirement
|
157
129
|
requirements:
|
158
130
|
- - "~>"
|
159
131
|
- !ruby/object:Gem::Version
|
160
|
-
version: '2.
|
132
|
+
version: '2.0'
|
161
133
|
type: :development
|
162
134
|
prerelease: false
|
163
135
|
version_requirements: !ruby/object:Gem::Requirement
|
164
136
|
requirements:
|
165
137
|
- - "~>"
|
166
138
|
- !ruby/object:Gem::Version
|
167
|
-
version: '2.
|
139
|
+
version: '2.0'
|
168
140
|
- !ruby/object:Gem::Dependency
|
169
141
|
name: selenium-webdriver
|
170
|
-
requirement: !ruby/object:Gem::Requirement
|
171
|
-
requirements:
|
172
|
-
- - ">="
|
173
|
-
- !ruby/object:Gem::Version
|
174
|
-
version: 3.13.1
|
175
|
-
type: :development
|
176
|
-
prerelease: false
|
177
|
-
version_requirements: !ruby/object:Gem::Requirement
|
178
|
-
requirements:
|
179
|
-
- - ">="
|
180
|
-
- !ruby/object:Gem::Version
|
181
|
-
version: 3.13.1
|
182
|
-
- !ruby/object:Gem::Dependency
|
183
|
-
name: webdrivers
|
184
142
|
requirement: !ruby/object:Gem::Requirement
|
185
143
|
requirements:
|
186
144
|
- - "~>"
|
187
145
|
- !ruby/object:Gem::Version
|
188
|
-
version:
|
146
|
+
version: 3.12.0
|
189
147
|
type: :development
|
190
148
|
prerelease: false
|
191
149
|
version_requirements: !ruby/object:Gem::Requirement
|
192
150
|
requirements:
|
193
151
|
- - "~>"
|
194
152
|
- !ruby/object:Gem::Version
|
195
|
-
version:
|
153
|
+
version: 3.12.0
|
196
154
|
- !ruby/object:Gem::Dependency
|
197
|
-
name:
|
155
|
+
name: webdrivers
|
198
156
|
requirement: !ruby/object:Gem::Requirement
|
199
157
|
requirements:
|
200
158
|
- - ">="
|
@@ -214,10 +172,10 @@ executables: []
|
|
214
172
|
extensions: []
|
215
173
|
extra_rdoc_files: []
|
216
174
|
files:
|
217
|
-
- ".github/workflows/ruby.yml"
|
218
175
|
- ".gitignore"
|
219
176
|
- ".rspec"
|
220
177
|
- ".solr_wrapper.yml"
|
178
|
+
- ".travis.yml"
|
221
179
|
- Gemfile
|
222
180
|
- LICENSE
|
223
181
|
- README.md
|
@@ -271,6 +229,7 @@ files:
|
|
271
229
|
- solr/conf/xslt/luke.xsl
|
272
230
|
- solr/sample_solr_documents.yml
|
273
231
|
- spec/features/blacklight_range_limit_spec.rb
|
232
|
+
- spec/features/javascript_spec.rb
|
274
233
|
- spec/fixtures/solr_documents/zero_year.yml
|
275
234
|
- spec/helpers/blacklight_range_limit_helper_spec.rb
|
276
235
|
- spec/lib/blacklight_range_limit/segment_calculation_spec.rb
|
@@ -301,12 +260,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
301
260
|
- !ruby/object:Gem::Version
|
302
261
|
version: '0'
|
303
262
|
requirements: []
|
304
|
-
|
263
|
+
rubyforge_project:
|
264
|
+
rubygems_version: 2.7.6
|
305
265
|
signing_key:
|
306
266
|
specification_version: 4
|
307
267
|
summary: Blacklight Range Limit plugin
|
308
268
|
test_files:
|
309
269
|
- spec/features/blacklight_range_limit_spec.rb
|
270
|
+
- spec/features/javascript_spec.rb
|
310
271
|
- spec/fixtures/solr_documents/zero_year.yml
|
311
272
|
- spec/helpers/blacklight_range_limit_helper_spec.rb
|
312
273
|
- spec/lib/blacklight_range_limit/segment_calculation_spec.rb
|
data/.github/workflows/ruby.yml
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
# This workflow uses actions that are not certified by GitHub.
|
2
|
-
# They are provided by a third-party and are governed by
|
3
|
-
# separate terms of service, privacy policy, and support
|
4
|
-
# documentation.
|
5
|
-
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
-
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
-
|
8
|
-
name: CI
|
9
|
-
|
10
|
-
on:
|
11
|
-
push:
|
12
|
-
branches: [ main, release-7.x, release-7.0.x ]
|
13
|
-
pull_request:
|
14
|
-
branches: [ main, release-7.x, release-7.0.x ]
|
15
|
-
|
16
|
-
jobs:
|
17
|
-
test:
|
18
|
-
runs-on: ubuntu-latest
|
19
|
-
name: test (ruby ${{ matrix.ruby }} / rails ${{ matrix.rails_version }})
|
20
|
-
strategy:
|
21
|
-
matrix:
|
22
|
-
ruby: [2.7, '3.0']
|
23
|
-
rails_version: ['6.1.5', '7.0.2.3']
|
24
|
-
additional_engine_cart_rails_options: ['']
|
25
|
-
include:
|
26
|
-
- ruby: '2.7'
|
27
|
-
rails_version: '5.2.4.2'
|
28
|
-
- ruby: '3.1'
|
29
|
-
rails_version: '7.0.2.3'
|
30
|
-
- ruby: '3.0'
|
31
|
-
rails_version: '7.0.2.3'
|
32
|
-
env:
|
33
|
-
RAILS_VERSION: ${{ matrix.rails_version }}
|
34
|
-
ENGINE_CART_RAILS_OPTIONS: "--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test ${{ matrix.engine_cart_rails_options }}"
|
35
|
-
steps:
|
36
|
-
- uses: actions/checkout@v3
|
37
|
-
- name: Set up Ruby
|
38
|
-
uses: ruby/setup-ruby@v1
|
39
|
-
with:
|
40
|
-
ruby-version: ${{ matrix.ruby }}
|
41
|
-
- name: Install dependencies
|
42
|
-
run: bundle install
|
43
|
-
- name: Run tests
|
44
|
-
run: bundle exec rake ci
|