Update notes for 2018-09-17

This commit is contained in:
2018-09-18 01:16:21 +03:00
parent 4cfa9aa101
commit 817f470888
3 changed files with 96 additions and 8 deletions

View File

@ -294,5 +294,45 @@ https://cgspace.cgiar.org/rest/statlets?handle=10568/97103
- Check if it's possible to have items deposited via REST use a workflow so we can perhaps tell ICARDA to use that from MEL
- Agree that we'll publicize AReS explorer on the week before the Big Data Platform workshop
- Put a link and or picture on the CGSpace homepage saying "Visualized CGSpace research" or something, and post a message on Yammer
- I want to explore creating a thin API to make the item view and download stats available from Solr so CodeObia can use them in the AReS explorer
- Currently CodeObia is exploring using the Atmire statlets internal API, but I don't really like that...
- There are some example queries on the [DSpace Solr wiki](https://wiki.duraspace.org/display/DSPACE/Solr)
- For example, this query returns 1655 rows for item [10568/10630](https://cgspace.cgiar.org/handle/10568/10630):
```
$ http 'http://localhost:3000/solr/statistics/select?indent=on&rows=0&q=type:0+owningItem:11576&fq=isBot:false'
```
- The id in the Solr query is the item's database id (get it from the REST API or something)
- Next, I adopted a query to get the downloads and it shows 889, which is similar to the number Atmire's statlet shows, though the query logic here is confusing:
```
$ http 'http://localhost:3000/solr/statistics/select?indent=on&rows=0&q=type:0+owningItem:11576&fq=isBot:false&fq=-(bundleName:[*+TO+*]-bundleName:ORIGINAL)&fq=-(statistics_type:[*+TO+*]+-statistics_type:view)'
```
- According to the [SolrQuerySyntax](https://wiki.apache.org/solr/SolrQuerySyntax) page on the Apache wiki, the `[* TO *]` syntax just selects a range (in this case all values for a field)
- So it seems to be:
- `type:0` is for bitstreams according to the DSpace Solr documentation
- `-(bundleName:[*+TO+*]-bundleName:ORIGINAL)` seems to be a [negative query starting with all documents](https://wiki.apache.org/solr/NegativeQueryProblems), subtracting those with `bundleName:ORIGINAL`, and then negating the whole thing... meaning only documents from `bundleName:ORIGINAL`?
- What the shit, I think I'm right: the simplified logic in *this* query returns the same 889:
```
$ http 'http://localhost:3000/solr/statistics/select?indent=on&rows=0&q=type:0+owningItem:11576&fq=isBot:false&fq=bundleName:ORIGINAL&fq=-(statistics_type:[*+TO+*]+-statistics_type:view)'
```
- And if I simplify the `statistics_type` logic the same way, it still returns the same 889!
```
$ http 'http://localhost:3000/solr/statistics/select?indent=on&rows=0&q=type:0+owningItem:11576&fq=isBot:false&fq=bundleName:ORIGINAL&fq=statistics_type:view'
```
- As for item views, I suppose that's just the same query, minus the `bundleName:ORIGINAL`:
```
$ http 'http://localhost:3000/solr/statistics/select?indent=on&rows=0&q=type:0+owningItem:11576&fq=isBot:false&fq=-bundleName:ORIGINAL&fq=statistics_type:view'
```
- That one returns 766, which is exactly 1655 minus 889...
- Also, Solr's `fq` is similar to the regular `q` query parameter, but it is considered for the Solr query cache so it should be faster for multiple queries
<!-- vim: set sw=2 ts=2: -->