Page History
...
Code Block |
---|
http://localhost:8080/solr/search/select?q=search.resourcetype:2&sort=dc.date.accessioned_dt%20desc |
Note:
search.resourcetype:2 | items |
search.resourcetype:3 | communities |
search.resourcetype:4 | collections |
To get only the first (newest) item (rows=1) with all but the date accessioned field filtered out (fl=dc.date.accessioned) and without the Solr response header (omitHeader=true):
...
Code Block |
---|
http://localhost:8080/solr/statistics/select?indent=on&version=2.2&start=0&rows=10&fl=*%2Cscore&qt=standard&wt=standard&explainOther=&hl.fl=&facet=true&facet.field=epersonid&q=type:0
|
Note:
facet.field=epersonid | You want to group by epersonid, which is the user id |
type:0 | Interested in bitstreams only |
Number of items in a specific community
...
Code Block |
---|
http://localhost:8080/solr/search/select/search/select/?q=location.comm:85+AND+search.resourcetype:2&version=2.2&start=0&rows=0&indent=on?q=location.comm:85+AND+search.resourcetype:2&start=0&rows=0&indent=on |
Statistics breakdown per event type
Starting from DSpace 3, there is a statistics_type
field in the statistics
core that contains the "usage event type". Currently, the available types are search
, view
, search_result
and workflow
. Here's how to get event breakdown by type, excluding robots (isBot:false
):
Code Block |
---|
http://localhost:8080/solr/statistics/select?indent=on&rows=0&facet=true&facet.field=statistics_type&q=isBot:false |
Statistics: breakdown of downloads per month
Show breakdown of bitstream (type:0
) downloads per month in the year 2016, excluding robots (isBot:false
):
Code Block |
---|
http://localhost:8080/solr/statistics/select?indent=on&rows=0&facet=true&facet.date=time&facet.date.start=2016-01-01T00:00:00Z&facet.date.end=2017-01-01T00:00:00Z&facet.date.gap=%2B1MONTH&q=type:0+AND+isBot:false |
Querying Solr from XMLUI
Since Solr returns its responses in XML, it's possible and easy to call custom Solr queries from XMLUI, process the XML response with XSLT and display the results in human-readable form on the HTML page.
There are two ways how to do that - synchronously in Cocoon or asynchronously using AJAX (JavaScript) after the page is loaded. Solr queries are usually very fast, so only synchronous calls will be shown here.
...
It should also be possible to use it in other versions of DSpace (starting from 1.6), but these use different versions of Solr, so modify the procedure accordingly (and expect other caveats):
DSpace 6 | Solr 4.10.2 |
DSpace 5 | Solr 4.10.2 |
DSpace 4 | Solr 4.4.0 |
DSpace 3 | Solr 3.5.0 |
DSpace 1.8 | Solr 3.3.0 |
DSpace 1.7 | Solr 1.4.1 |
DSpace 1.6 | Solr 1.3.0 |
Note: In older versions, you may need to specify the queryResponseWriter class as org.apache.solr.request.VelocityResponseWriter
(I haven't tested it, though)
...