December, 2024
+ +2024-12-04
+-
+
- We need to get view and download statistics for the last year from CGSpace
+
-
+
- The only way to get that is using Solr +
+
-
+
- After consulting the Solr documentation I came up with this facet query: +
++facet.range=time&facet.range.start=NOW/MONTH-11MONTHS&facet.range.end=NOW/MONTH+1MONTH&facet.range.gap=+1MONTH
+
-
+
- This StackOverflow answer helped too, recommending
NOW/MONTH
to get neatly bucketed months because this will use the beginning of the current month
+ - For views, I added the following query parameters:
q=type:2&fq=-isBot:true AND statistics_type:view
+
++http://localhost:8983/solr/statistics/select?facet.range.end=NOW%2FMONTH%2B1MONTH&facet.range.gap=%2B1MONTH&facet.range.start=NOW%2FMONTH-11MONTHS&facet.range=time&facet=true&fq=-isBot%3Atrue%20AND%20statistics_type%3Aview&indent=true&q.op=OR&q=type%3A2&rows=0
+
-
+
- For downloads I added the following query parameters:
q=type:0&fq=-isBot:true AND statistics_type:view AND bundleName:ORIGINAL
+
++ + + + + + +http://localhost:8983/solr/statistics/select?facet.range.end=NOW%2FMONTH%2B1MONTH&facet.range.gap=%2B1MONTH&facet.range.start=NOW%2FMONTH-11MONTHS&facet.range=time&facet=true&fq=-isBot%3Atrue%20AND%20statistics_type%3Aview%20AND%20bundleName%3AORIGINAL&indent=true&q.op=OR&q=type%3A0&rows=0
+