Ignore:
Timestamp:
2017-03-02T23:28:38+13:00 (7 years ago)
Author:
davidb
Message:

shift to using solr-base-url and a specified solr-collection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/hathitrust/wcsa/extracted-features-solr/trunk/solr-ingest/src/main/java/org/hathitrust/extractedfeatures/PerVolumeJSON.java

    r31450 r31451  
    3232    protected String _langmap_directory;
    3333   
    34     protected String _solr_url;
     34    protected final ArrayList<String> _solr_endpoints;
     35    protected final int _solr_endpoints_len;
     36   
     37    //protected String _solr_url;
    3538    protected String _output_dir;
    3639   
     
    4447
    4548    public PerVolumeJSON(String input_dir, String whitelist_filename, String langmap_directory,
    46                          String solr_url, String output_dir, int verbosity,
     49                         ArrayList<String> solr_endpoints, String output_dir, int verbosity,
    4750                         boolean icu_tokenize, boolean strict_file_io)
    4851    {
     
    5356        _langmap_directory = langmap_directory;
    5457       
    55         _solr_url   = solr_url;
     58        _solr_endpoints = solr_endpoints;
     59        _solr_endpoints_len = solr_endpoints.size();
     60       
     61        //_solr_url   = solr_url;
    5662        _output_dir = output_dir;
    5763        _verbosity  = verbosity;
     
    7783        int ef_num_pages = 0;
    7884
     85        String solr_url = null;
     86        if (_solr_endpoints_len > 0) {
     87            int random_choice = (int)(_solr_endpoints_len * Math.random());
     88            solr_url = _solr_endpoints.get(random_choice);
     89        }
     90       
    7991        try {
    8092
     
    125137
    126138
    127                         if (_solr_url != null) {
     139                        if (solr_url != null) {
    128140                            if ((_verbosity >=2) && (i==20)) {
    129141                                System.out.println("==================");
    130                                 System.out.println("Posting to: " + _solr_url);
     142                                System.out.println("Posting to: " + solr_url);
    131143                                System.out.println("==================");
    132144                            }
    133                             SolrDocJSON.postSolrDoc(_solr_url, solr_add_doc_json);
     145                            SolrDocJSON.postSolrDoc(solr_url, solr_add_doc_json);
    134146                        }
    135147
Note: See TracChangeset for help on using the changeset viewer.