The plugin pretty much supports 'integers' -- so as far as dates, if
your dates are just years, that's fine (and that's the main use case
it's intended for). If your dates need to be year/month/date, the plugin
does not support that right now.
Maybe we need some screenshots of what the plugin does, easier to
explain with a picture than with words. I'm not sure if it's installed
in our BL "demo". But you can look at our JH BL to see the range plugin
in action, do a search and look at the "Publication Year" limit on the
left, that's the range plugin at work. http://catalyst.library.jhu.edu
> If a single record has a range associated with it (startDate = 1900,
endDate = 1910) and someone searches on 1905, could the plugin find a
match?
There's no built in way to do that exactly, but you might be able to get
it to work this way, by indexing into a multi-valued field, where each
year in the range represented by the document is present as a value.
That will make range searches work -- but will make the 'counts' for the
bar chart or 'facets' kind of odd, as one document will show up multiple
times. It may make the bar chart/facets unusable by being so weird, I'm
not sure.
There might be a different way to handle this on the Solr/lucene end,
but I'm not sure what it is. I'm not quite sure what the bar
chart/facets _ought_ to look like in cases where each document covers a
range. If you can figure it out, and figure out how to make the range
plugin deal with it, happy to accept a pull request.
Alternately, since the range plugin is really focused on the bar
chart/facets, and it's unclear how to make them work with your data,
perhaps you should just abandon the range plugin and barcharts, and just
do simple range searches where the endpoints are entered by hand. You
don't need the range plugin to do that, most of the code in the range
plugin and it's complexity is focused on the barcharts.
I don't know if anyone has written a simpler plugin that just does range
searches by itself, perhaps because that's a fairly straightforward
thing to do implement yourself once you understand hwo Solr works and
how BL works (big 'once's, I understand; perhaps it would be useful if
someone wrote such a plugin, but I don't think anyone has).
Jonathan
The plugin doesn't take care of indexing anyway. So, at indexing, if a
document is "1900-1904" (inclusive), actually index the values
'exploded'/'flattened' into six values, 1900,1901,1902,1903,1904
The range plugin should actually then work. It's just that the
bargraph/facet segment will multi-count it. Which might actually be what
you want, I'm not sure -- I'm not sure what you'd want a
segment/facet/bargraph/histograph display to look like in this case.
Let's say you had two documents in your index, one was 1900-1904
inclusive (that's 5 years), and one was 1903 only. And let's say you
generate the facet count/histogram for 1900-1905.
You'll get a count of "1" for every year from 1900-1904, with a count of
"2" for 1903. Even though there's actually only two documents in the
range at all, there are 6 counted items in the graph.
But I'm not sure how you'd simply do a facet/histogram over the range
anyway BUT this. I have no idea if this will be confusing or match
user's expectations. But if it turns out that's actually what you WANT,
you should be able to use the range plugin while indexing into a
multivalued field to get it.
But yeah, if you don't want the bargraph style histograms displaying
distribution of things in your range, you may be better off not using
blacklight_range_plugin -- that's the main thing it adds, and most of
it's (sometimes convoluted) code is focused on that.
* Are you using a recent version of BL, with the asset pipeline?
* Do you have the latest version of BL and the latest version of the
plugin (certain old versions of the plugin didn't work quite right out
of the box, and required local hacks; I'm afraid I can't personally
support those, figure/out remember what the local hacks were).
* Is the advanced search js included in your asset pipeline
application.js manifest file? (The range generator should have added
it, but double check)
* Have you configured the facets you wanted rangeified with range=>true
in the BL config?
* Have you NOT configured the range plugin specially to _disable_ the
javascript or anything like that?
It's certainly possible you're running into a bug of one kind or
another, but I did recently confirm that the _latest_ version of the
range plugin works properly as documented (for me) with the latest
version of BL. I think I had to make a few tweaks to get it there
though, a couple weeks ago.
Yeah, nothing 'advanced' should have anything to do with it -- wait, you
aren't talking about your range facet _showing up_ on the advanced
search input form, are you?
Yeah, I don't think that's out of the box supported yet, range_limit and
advanced_search automatically playing well together. You can hack it
together yourself. If that's what you're talking about, someone can try
to explain.
Otherwise, we can continue debugging -- do you get range facet properly
on your actual search results facets? If not, is the
blacklight_range_limit js referenced in your
app/assets/javascripts/application.js ?
Some of us have hacked it in ourselves; I'll try to find time to write
up how I did that if nobody else gets to it first.
But basically, just look at the query parameters produced when you enter
values in the range search boxes on the ordinary facet display.
You need to make a local customizable copy of the advanced search form,
and then you need to add html inputs to it that will result in the same
query parameters that the range limit would ordinarily produce. That's
about it.
Jonathan