Project

General

Profile

« Previous | Next » 

Revision 7731

Added by Jing Tao about 11 years ago

changed the xpath to get solr_spec_version.

View differences:

metacat-common/src/main/java/edu/ucsb/nceas/metacat/common/query/HttpSolrQueryService.java
81 81
    private static final String SOLR_SYSTEMINFO_URLAPPENDIX = "solr.systeminfo.urlappendix";
82 82
    private static final String SOLR_SCHEMA_URLAPPENDIX = "sorl.schema.urlappendix";
83 83
    private static final String SOLR_CONFIG_URLAPPENDIX = "solr.config.urlappendix";
84
    private static final String SPEC_PATH = "//str[@name=\"solr-spec-version\"]";
84
    private static final String SPEC_PATH = "//str[@name='solr-spec-version']";
85 85
    private static final String FIELDS_PATH = "//fields//field";
86 86
    private static final String COPY_FIELDS_PATH = "//copyField";
87 87
    private static final String DEST = "dest";
......
180 180
        if(fieldMap == null || fieldMap.isEmpty()) {
181 181
            getIndexSchemaFieldFromServer();
182 182
        }
183
        //System.out.println("get filed map ==========================");
183 184
        return fieldMap;
184 185
    }
185 186
    
......
209 210
     * @throws SAXException
210 211
     */
211 212
    private void getIndexSchemaFieldFromServer() throws MalformedURLException, ParserConfigurationException, IOException, SAXException {
213
        //System.out.println("get filed map from server (downloading files) ==========================");
212 214
        SolrConfig config = new SolrConfig("dataone", new InputSource(getSolrConfig())); 
213 215
        schema = new IndexSchema(config, "dataone", new InputSource(getSchema()));
214 216
        fieldMap = schema.getFields();
......
276 278
    public String getSolrServerVersion() {
277 279
        if(solrSpecVersion == null) {
278 280
            getHttpSolrServerVersion();
279
        }  
281
        } 
282
        //System.out.println("get spec version  ==========================");
280 283
        return solrSpecVersion;
281 284
    }
282 285
    
......
285 288
     * Get the solr server version from the system information url. 
286 289
     */
287 290
    private void getHttpSolrServerVersion() {
291
        //System.out.println("get spec version from server (downloading files) ==========================");
288 292
        String systemInfoUrlAppendix = Settings.getConfiguration().getString(SOLR_SYSTEMINFO_URLAPPENDIX);
289 293
        String systemInfoUrl = solrServerBaseURL+systemInfoUrlAppendix;
290 294
        try {
......
292 296
            NodeList nodeList = (NodeList) XPathFactory.newInstance().newXPath()
293 297
                            .evaluate(SPEC_PATH, doc, XPathConstants.NODESET);
294 298
            if(nodeList != null && nodeList.getLength() >0) {
299
                //System.out.println("nodelist is not null branch");
295 300
                Node specNode = nodeList.item(0);
296 301
                solrSpecVersion = specNode.getFirstChild().getNodeValue();
297 302
            } else {
303
                //System.out.println("nodelist is null branch");
298 304
                solrSpecVersion = UNKNOWN;
299 305
            }
300 306
            

Also available in: Unified diff