cgspace-notes/docs/2024-12/index.html
2024-12-04 16:27:49 +03:00

221 lines
6.4 KiB
HTML

<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta property="og:title" content="December, 2024" />
<meta property="og:description" content="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
" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://alanorth.github.io/cgspace-notes/2024-12/" />
<meta property="article:published_time" content="2024-12-04T10:19:00+03:00" />
<meta property="article:modified_time" content="2024-12-04T10:19:00+03:00" />
<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="December, 2024"/>
<meta name="twitter:description" content="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
"/>
<meta name="generator" content="Hugo 0.133.1">
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BlogPosting",
"headline": "December, 2024",
"url": "https://alanorth.github.io/cgspace-notes/2024-12/",
"wordCount": "85",
"datePublished": "2024-12-04T10:19:00+03:00",
"dateModified": "2024-12-04T10:19:00+03:00",
"author": {
"@type": "Person",
"name": "Alan Orth"
},
"keywords": "Notes"
}
</script>
<link rel="canonical" href="https://alanorth.github.io/cgspace-notes/2024-12/">
<title>December, 2024 | CGSpace Notes</title>
<!-- combined, minified CSS -->
<link href="https://alanorth.github.io/cgspace-notes/css/style.c6ba80bc50669557645abe05f86b73cc5af84408ed20f1551a267bc19ece8228.css" rel="stylesheet" integrity="sha256-xrqAvFBmlVdkWr4F&#43;GtzzFr4RAjtIPFVGiZ7wZ7Ogig=" crossorigin="anonymous">
<!-- minified Font Awesome for SVG icons -->
<script defer src="https://alanorth.github.io/cgspace-notes/js/fontawesome.min.f5072c55a0721857184db93a50561d7dc13975b4de2e19db7f81eb5f3fa57270.js" integrity="sha256-9QcsVaByGFcYTbk6UFYdfcE5dbTeLhnbf4HrXz&#43;lcnA=" crossorigin="anonymous"></script>
<!-- RSS 2.0 feed -->
</head>
<body>
<div class="blog-masthead">
<div class="container">
<nav class="nav blog-nav">
<a class="nav-link " href="https://alanorth.github.io/cgspace-notes/">Home</a>
</nav>
</div>
</div>
<header class="blog-header">
<div class="container">
<h1 class="blog-title" dir="auto"><a href="https://alanorth.github.io/cgspace-notes/" rel="home">CGSpace Notes</a></h1>
<p class="lead blog-description" dir="auto">Documenting day-to-day work on the <a href="https://cgspace.cgiar.org">CGSpace</a> repository.</p>
</div>
</header>
<div class="container">
<div class="row">
<div class="col-sm-8 blog-main">
<article class="blog-post">
<header>
<h2 class="blog-post-title" dir="auto"><a href="https://alanorth.github.io/cgspace-notes/2024-12/">December, 2024</a></h2>
<p class="blog-post-meta">
<time datetime="2024-12-04T10:19:00+03:00">Wed Dec 04, 2024</time>
in
<span class="fas fa-folder" aria-hidden="true"></span>&nbsp;<a href="/categories/notes/" rel="category tag">Notes</a>
</p>
</header>
<h2 id="2024-12-04">2024-12-04</h2>
<ul>
<li>We need to get view and download statistics for the last year from CGSpace
<ul>
<li>The only way to get that is using Solr</li>
</ul>
</li>
</ul>
<ul>
<li>After consulting the <a href="https://solr.apache.org/guide/8_11/working-with-dates.html">Solr documentation</a> I came up with this facet query:</li>
</ul>
<blockquote>
<p>facet.range=time&amp;facet.range.start=NOW/MONTH-11MONTHS&amp;facet.range.end=NOW/MONTH+1MONTH&amp;facet.range.gap=+1MONTH</p>
</blockquote>
<ul>
<li><a href="https://stackoverflow.com/questions/34290600/how-to-apply-facet-on-date-field-where-result-should-provide-number-of-records-f">This StackOverflow answer</a> helped too, recommending <code>NOW/MONTH</code> to get neatly bucketed months because this will use the beginning of the current month</li>
<li>For views, I added the following query parameters: <code>q=type:2&amp;fq=-isBot:true AND statistics_type:view</code></li>
</ul>
<blockquote>
<p>http://localhost:8983/solr/statistics/select?facet.range.end=NOW%2FMONTH%2B1MONTH&amp;facet.range.gap=%2B1MONTH&amp;facet.range.start=NOW%2FMONTH-11MONTHS&amp;facet.range=time&amp;facet=true&amp;fq=-isBot%3Atrue%20AND%20statistics_type%3Aview&amp;indent=true&amp;q.op=OR&amp;q=type%3A2&amp;rows=0</p>
</blockquote>
<ul>
<li>For downloads I added the following query parameters: <code>q=type:0&amp;fq=-isBot:true AND statistics_type:view AND bundleName:ORIGINAL</code></li>
</ul>
<blockquote>
<p>http://localhost:8983/solr/statistics/select?facet.range.end=NOW%2FMONTH%2B1MONTH&amp;facet.range.gap=%2B1MONTH&amp;facet.range.start=NOW%2FMONTH-11MONTHS&amp;facet.range=time&amp;facet=true&amp;fq=-isBot%3Atrue%20AND%20statistics_type%3Aview%20AND%20bundleName%3AORIGINAL&amp;indent=true&amp;q.op=OR&amp;q=type%3A0&amp;rows=0</p>
</blockquote>
<!-- raw HTML omitted -->
</article>
</div> <!-- /.blog-main -->
<aside class="col-sm-3 ml-auto blog-sidebar">
<section class="sidebar-module">
<h4>Recent Posts</h4>
<ol class="list-unstyled">
<li><a href="/cgspace-notes/2024-12/">December, 2024</a></li>
<li><a href="/cgspace-notes/2024-11/">November, 2024</a></li>
<li><a href="/cgspace-notes/2024-10/">October, 2024</a></li>
<li><a href="/cgspace-notes/2024-09/">September, 2024</a></li>
<li><a href="/cgspace-notes/2024-08/">August, 2024</a></li>
</ol>
</section>
<section class="sidebar-module">
<h4>Links</h4>
<ol class="list-unstyled">
<li><a href="https://cgspace.cgiar.org">CGSpace</a></li>
<li><a href="https://dspacetest.cgiar.org">DSpace Test</a></li>
<li><a href="https://github.com/ilri/DSpace">CGSpace @ GitHub</a></li>
</ol>
</section>
</aside>
</div> <!-- /.row -->
</div> <!-- /.container -->
<footer class="blog-footer">
<p dir="auto">
Blog template created by <a href="https://twitter.com/mdo">@mdo</a>, ported to Hugo by <a href='https://twitter.com/mralanorth'>@mralanorth</a>.
</p>
<p>
<a href="#">Back to top</a>
</p>
</footer>
</body>
</html>