Search in sources :

Example 1 with SolrProxy

use of org.opensextant.util.SolrProxy in project Xponents by OpenSextant.

the class SolrGazetteer method initialize.

/**
     * Initialize. Cascading env variables: First use value from constructor,
     * then opensextant.solr, then solr.solr.home
     *
     * @throws ConfigException
     *             Signals that a configuration exception has occurred.
     */
private void initialize(String solrHome) throws ConfigException {
    solr = solrHome != null ? new SolrProxy(solrHome, "gazetteer") : new SolrProxy("gazetteer");
    params.set(CommonParams.Q, "*:*");
    params.set(CommonParams.FL, "id,name,cc,adm1,adm2,feat_class,feat_code,geo,place_id,name_bias,id_bias,name_type");
    try {
        this.countryCodes = loadCountries(solr.getInternalSolrServer());
    } catch (SolrServerException loadErr) {
        throw new ConfigException("SolrGazetteer is unable to load countries due to Solr error", loadErr);
    } catch (IOException ioErr) {
        throw new ConfigException("SolrGazetteer is unable to load countries due to IO/file error", ioErr);
    }
}
Also used : SolrProxy(org.opensextant.util.SolrProxy) SolrServerException(org.apache.solr.client.solrj.SolrServerException) ConfigException(org.opensextant.ConfigException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 SolrServerException (org.apache.solr.client.solrj.SolrServerException)1 ConfigException (org.opensextant.ConfigException)1 SolrProxy (org.opensextant.util.SolrProxy)1