diff --git a/content/posts/2019-01.md b/content/posts/2019-01.md index 48cc80a8a..b85d249a2 100644 --- a/content/posts/2019-01.md +++ b/content/posts/2019-01.md @@ -679,5 +679,30 @@ $ http 'http://localhost:3000/solr/statistics-2018/select?indent=on&rows=0&q=typ - I opened an issue on the GitHub issue tracker ([#10](https://github.com/ilri/dspace-statistics-api/issues/10)) - I don't think the [SolrClient library](https://solrclient.readthedocs.io/en/latest/) we are currently using supports these type of queries so we might have to just do raw queries with requests +- The [pysolr](https://github.com/django-haystack/pysolr) library says it supports multicore indexes, but I am not sure it does (or at least not with our setup): + +``` +import pysolr +solr = pysolr.Solr('http://localhost:3000/solr/statistics') +results = solr.search('type:2', **{'fq': 'isBot:false AND statistics_type:view', 'facet': 'true', 'facet.field': 'id', 'facet.mincount': 1, 'facet.limit': 10, 'facet.offset': 0, 'rows': 0}) +print(results.facets['facet_fields']) +{'id': ['77572', 646, '93185', 380, '92932', 375, '102499', 372, '101430', 337, '77632', 331, '102449', 289, '102485', 276, '100849', 270, '47080', 260]} +``` + +- If I double check one item from above, for example `77572`, it appears this is only working on the current statistics core and not the shards: + +``` +import pysolr +solr = pysolr.Solr('http://localhost:3000/solr/statistics') +results = solr.search('type:2 id:77572', **{'fq': 'isBot:false AND statistics_type:view'}) +print(results.hits) +646 +solr = pysolr.Solr('http://localhost:3000/solr/statistics-2018/') +results = solr.search('type:2 id:77572', **{'fq': 'isBot:false AND statistics_type:view'}) +print(results.hits) +595 +``` + +- So I guess I need to figure out how to use join queries and maybe even switch to using raw Python requests with JSON diff --git a/docs/2019-01/index.html b/docs/2019-01/index.html index b863d95d2..7d275a82a 100644 --- a/docs/2019-01/index.html +++ b/docs/2019-01/index.html @@ -27,7 +27,7 @@ I don’t see anything interesting in the web server logs around that time t " /> - + @@ -60,9 +60,9 @@ I don’t see anything interesting in the web server logs around that time t "@type": "BlogPosting", "headline": "January, 2019", "url": "https://alanorth.github.io/cgspace-notes/2019-01/", - "wordCount": "3120", + "wordCount": "3266", "datePublished": "2019-01-02T09:48:30+02:00", - "dateModified": "2019-01-20T17:14:43+02:00", + "dateModified": "2019-01-21T12:54:29+02:00", "author": { "@type": "Person", "name": "Alan Orth" @@ -930,6 +930,33 @@ $ http 'http://localhost:3000/solr/statistics-2018/select?indent=on&rows=0&a + +
import pysolr
+solr = pysolr.Solr('http://localhost:3000/solr/statistics')
+results = solr.search('type:2', **{'fq': 'isBot:false AND statistics_type:view', 'facet': 'true', 'facet.field': 'id', 'facet.mincount': 1, 'facet.limit': 10, 'facet.offset': 0, 'rows': 0})
+print(results.facets['facet_fields'])
+{'id': ['77572', 646, '93185', 380, '92932', 375, '102499', 372, '101430', 337, '77632', 331, '102449', 289, '102485', 276, '100849', 270, '47080', 260]}
+
+ + + +
import pysolr
+solr = pysolr.Solr('http://localhost:3000/solr/statistics')
+results = solr.search('type:2 id:77572', **{'fq': 'isBot:false AND statistics_type:view'})
+print(results.hits)
+646
+solr = pysolr.Solr('http://localhost:3000/solr/statistics-2018/')
+results = solr.search('type:2 id:77572', **{'fq': 'isBot:false AND statistics_type:view'})
+print(results.hits)
+595
+
+ + diff --git a/docs/sitemap.xml b/docs/sitemap.xml index c7444fe1d..c0e7ec138 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -4,7 +4,7 @@ https://alanorth.github.io/cgspace-notes/2019-01/ - 2019-01-20T17:14:43+02:00 + 2019-01-21T12:54:29+02:00 @@ -204,7 +204,7 @@ https://alanorth.github.io/cgspace-notes/ - 2019-01-20T17:14:43+02:00 + 2019-01-21T12:54:29+02:00 0 @@ -215,7 +215,7 @@ https://alanorth.github.io/cgspace-notes/tags/notes/ - 2019-01-20T17:14:43+02:00 + 2019-01-21T12:54:29+02:00 0 @@ -227,13 +227,13 @@ https://alanorth.github.io/cgspace-notes/posts/ - 2019-01-20T17:14:43+02:00 + 2019-01-21T12:54:29+02:00 0 https://alanorth.github.io/cgspace-notes/tags/ - 2019-01-20T17:14:43+02:00 + 2019-01-21T12:54:29+02:00 0