If your statistics are using Solr, there will be a dspace/solr/statistics 
folder.

I had to bring statistics from version 1.8.3 to 4.2.

I optimised under 1.8.3 and then 4.2, but found that the old records were 
missing uid, _version_ and statistics_type fields. I ended up copying all 
the records and deleting the originals. I don't know whether that was a 
sensible solution, but it seemed to work.

I ran the following (sorry, it's Python) to talk to Solr under 4.2. The 
debug was in there to allow investigation if anything unexpected happened 
(it didn't).

#! /usr/bin/python

import urllib2
import json
import pdb

BATCH_SIZE=10000
REQ_URL='http://127.0.0.1:8080/solr/statistics/select?q=*:*+AND+-uid:[*%%20TO%%20*]&wt=json&indent=true&rows=%d&start=%d'
UPDATE_URL='http://localhost:8080/solr/statistics/update'

start = 0

query_res = urllib2.urlopen(REQ_URL%(BATCH_SIZE,start))
if query_res.getcode() != 200:
     pdb.set_trace()
doc_list = json.load(query_res)['response']['docs']
while doc_list:
     start += BATCH_SIZE
     update_req = 
urllib2.Request(UPDATE_URL,json.dumps(doc_list),{'Content-type':'application/json'})
     update_res = urllib2.urlopen(update_req)
     if update_res.getcode() != 200:
         pdb.set_trace()
     print "Added %d" % start
     query_res = urllib2.urlopen(REQ_URL%(BATCH_SIZE,start))
     if query_res.getcode() != 200:
         pdb.set_trace()
     doc_list = json.load(query_res)['response']['docs']

# If the above goes OK, we can delete everything without a uid field
update_req = urllib2.Request(UPDATE_URL,'{"delete":{"query":"-uid:[* TO 
*]"}}',{'Content-type':'application/json'})
update_res = urllib2.urlopen(update_req)
if update_res.getcode() != 200:
     pdb.set_trace()

commit_res = urllib2.urlopen(UPDATE_URL+'?commit=true')
if commit_res.getcode() != 200:
     pdb.set_trace()


Steven Hayles
Systems Analyst

IT Services, University of Leicester,
Propsect House, 94 Regent Rd, Leicester, LE1 7DA, UK

T: +44 (0)116 229 7950
E: s...@le.ac.uk

The Queen's Anniversary Prizes 1994, 2002 & 2013
THE Awards Winners 2007-2013

Elite without being elitist

Follow us on Twitter http://twitter.com/uniofleicester or
visit our Facebook page https://facebook.com/UniofLeicester


> On 1 February 2015 at 14:43, . . <alsap...@hotmail.es> wrote:
>
>> Hello, we DSpace version 1.6 running (we do not have installed). We have
>> made the upgrade to version 4.2 andand works correctly).
>>
>> Now, we want to migrate to statistics from the old version 1.6 to 4.2. I
>> think in 1.6 statistics run through solr. How can I check? And if so, how
>> would the migration?
>>
>> regards

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
DSpace-tech mailing list
DSpace-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech
List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette

Reply via email to