Ivan and Hardy, thanks for the advice.
I took a different approach today, and tried to code a solution in java.
This code appears to do what I need on my test server. Given that these
are statistics records and the structure is fairly simple, this might do
what I need.
The stats records did not seem to have a unique id, so I believe that I
will need to delete them via a query.
The count limits in this code are tuned to the number of authentication
records that I would like to cleanup.
If anyone has a suggestion for improving this process, please let me know
your suggestion.
Thanks, Terry
public class SolrUpdate {
public static void main(String[] args) {
String url = "http://localhost/solr/statistics";
try {
String myQuery = "epersonid:[1 TO *]";
if (args.length > 0) myQuery= "epersonid:" + args[0];
HttpSolrServer server = new HttpSolrServer( url );
//server.setRequestWriter(new BinaryRequestWriter());
SolrQuery sq = new SolrQuery();
sq.setQuery(myQuery);
sq.setRows(200000);
XMLResponseParser xrp = new XMLResponseParser();// {
// public String getContentType() {return "text/xml";}
//};
server.setParser(xrp);
QueryResponse resp = server.query(sq);
SolrDocumentList list = resp.getResults();
System.err.println(list.getNumFound() + " / " + list.size());
ArrayList<SolrInputDocument> idocs = new ArrayList<SolrInputDocument>();
if (list.size() == 0) {
System.err.println("No items for query");
return;
}
for(int i=0; i<list.size(); i++) {
System.err.println(i);
SolrDocument doc = list.get(i);
doc.setField("epersonid", 0);
SolrInputDocument idoc = new
SolrInputDocument(ClientUtils.toSolrInputDocument(doc));
//System.err.println(idoc.toString());
idocs.add(idoc);
}
server.deleteByQuery(myQuery);
server.add(idocs);
server.commit();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
On Fri, Apr 18, 2014 at 9:00 AM, Pottinger, Hardy J. <
[email protected]> wrote:
> Hi, I did some searching just now, and found this...
>
> http://wiki.apache.org/solr/UpdateCSV
>
> ...might help?
>
> --Hardy
>
> Sent from my iPad
>
> On Apr 17, 2014, at 3:53 PM, "Terry Brady" <[email protected]> wrote:
>
> We would like to make our usage statistics anonymous.
>
> I would like to update all statistics records with an epersonid value.
>
> - q=epersonid:[0 TO *]
>
> Once the records are found, I would like to set the epersonid to 0.
>
> Is there a way to do this with a single curl statement?
>
> We are running DSpace 3.1.
>
> If not, could someone suggest a good approach to accomplish this task?
>
> Thanks, Terry
>
> --
> Terry Brady
> Applications Programmer Analyst
> Georgetown University Library Information Technology
> https://www.library.georgetown.edu/lit/code
> 202-687-7053
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
>
> _______________________________________________
> DSpace-tech mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/dspace-tech
> List Etiquette:
> https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette
>
>
--
Terry Brady
Applications Programmer Analyst
Georgetown University Library Information Technology
https://www.library.georgetown.edu/lit/code
202-687-7053
------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech
List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette