Ignore:
Timestamp:
2017-05-11T22:19:06+12:00 (7 years ago)
Author:
davidb
Message:

More careful set of metadata fields indexed

File:
1 edited

Legend:

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

    r31597 r31675  
    3434    {
    3535        JSONObject solr_update_json = null;
    36        
     36        /*
     37         Example JSON for id: "gri.ark:/13960/t0003qw46
     38         metadata: {
     39         
     40        "accessProfile": "open",
     41        "bibliographicFormat": "BK",
     42        "classification": {
     43            "lcc": [
     44                "ND646 .B8 1900"
     45            ]
     46        },
     47        "dateCreated": "2016-06-19T08:30:16.11199Z",
     48        "enumerationChronology": " ",
     49        "genre": [
     50            "not fiction"
     51        ],
     52        "governmentDocument": false,
     53        "handleUrl": "http://hdl.handle.net/2027/gri.ark:/13960/t0003qw46",
     54        "hathitrustRecordNumber": "100789562",
     55        "htBibUrl": "http://catalog.hathitrust.org/api/volumes/full/htid/gri.ark:/13960/t0003qw46.json",
     56        "imprint": "Burlington Fine Arts Club, 1900.",
     57        "isbn": [],
     58        "issn": [],
     59        "issuance": "monographic",
     60        "language": "eng",
     61        "lastUpdateDate": "2015-09-14 13:25:03",
     62        "lccn": [],
     63        "names": [
     64            "Burlington Fine Arts Club "
     65        ],
     66        "oclc": [
     67            "25259734"
     68        ],
     69        "pubDate": "1900",
     70        "pubPlace": "enk",
     71        "rightsAttributes": "pd",
     72        "schemaVersion": "1.3",
     73        "sourceInstitution": "CMALG",
     74        "sourceInstitutionRecordNumber": "9928077890001551",
     75        "title": "Exhibition of pictures by Dutch masters of the seventeenth century.",
     76        "typeOfResource": "text",
     77        "volumeIdentifier": "gri.ark:/13960/t0003qw46"
     78
     79          }
     80         
     81         */
    3782       
    3883        String [] metadata_single = new String[] {
    3984                "accessProfile",
    40                 "rightsAttributes",
    41                 "hathitrustRecordNumber",
    42                 "title",
     85                "bibliographicFormat",
     86                "dateCreated",              // date
     87                //"enumerationChronology",  // What is this?
     88                "governmentDocument",       // bool: true/false
     89                "handleUrl",
     90                "hathitrustRecordNumber",   // int?
     91                "htBibUrl",
    4392                "imprint",
     93                "issuance",
     94                "language",
     95                "lastUpdateDate",
    4496                "pubDate",
    4597                "pubPlace",
    46                 "language",
    47                 "issuance",
    48                 "typeOfResource"
     98                "rightsAttributes",
     99                "schemaVersion",
     100                "sourceInstitution",
     101                "sourceInstitutionRecordNumber",
     102                "title",
     103                "typeOfResource",
     104                "volumeIdentifier"
    49105        };
    50106
     
    58114        };
    59115
     116        String [] metadata_hashmap_multiple = new String[] {
     117                "classification"
     118        };
     119       
     120       
    60121        if (ef_metadata != null) {
    61122           
     
    82143                    solr_doc_json.put(metaname+"_t",metavalues);
    83144                    solr_doc_json.put(metaname+"_ss",metavalues);
     145                }
     146            }
     147           
     148            for (String metaname: metadata_hashmap_multiple) {
     149                JSONObject metakeys = ef_metadata.getJSONObject(metaname);
     150               
     151                if (metakeys != null) {
     152                    Iterator<String> metakey_iter = metakeys.keys();
     153                    while (metakey_iter.hasNext()) {
     154                        String metakey = metakey_iter.next();
     155                       
     156                        JSONArray metavalues = metakeys.getJSONArray(metakey);
     157                        if (metavalues != null) {
     158                            String combined_metaname = metaname + "_" + metakey;
     159                            solr_doc_json.put(combined_metaname+"_t",metavalues);
     160                            solr_doc_json.put(combined_metaname+"_ss",metavalues);
     161                        }   
     162                    }
    84163                }
    85164            }
Note: See TracChangeset for help on using the changeset viewer.