Пример #1
0
 protected void init(String layerName, String geometryField) throws Exception {
   this.layerName = layerName;
   SolrLayerConfiguration solrLayerConfiguration =
       new SolrLayerConfiguration(new ArrayList<SolrAttribute>());
   solrLayerConfiguration.setLayerName(this.layerName);
   List<SolrAttribute> layerAttributes = new ArrayList<>();
   for (SolrAttribute solrAttribute : attributes) {
     if (geometryField.equals(solrAttribute.getName())) {
       SolrAttribute copy = new SolrAttribute(solrAttribute);
       copy.setDefaultGeometry(true);
       layerAttributes.add(copy);
     } else {
       layerAttributes.add(solrAttribute);
     }
   }
   solrLayerConfiguration.getAttributes().addAll(layerAttributes);
   dataStore.setSolrConfigurations(solrLayerConfiguration);
   featureSource = (SolrFeatureSource) dataStore.getFeatureSource(this.layerName);
 }
Пример #2
0
 @Override
 public Object visit(Id filter, Object extraData) {
   StringWriter output = asStringWriter(extraData);
   Set<Identifier> ids = filter.getIdentifiers();
   output.append(" (");
   for (Iterator<Identifier> i = ids.iterator(); i.hasNext(); ) {
     Identifier id = i.next();
     String fid = decodeFID(id.toString());
     output.write(primaryKey.getName() + ":" + "\"" + fid + "\"");
     if (i.hasNext()) {
       output.write(" OR ");
     }
   }
   output.append(") ");
   return output;
 }
Пример #3
0
  @Override
  protected void connect() throws Exception {
    String url = fixture.getProperty(SolrDataStoreFactory.URL.key);
    setUpSolrFile(url);

    Map params = createConnectionParams(url, fixture);

    SolrDataStoreFactory factory = new SolrDataStoreFactory();
    dataStore = (SolrDataStore) factory.createDataStore(params);

    attributes = dataStore.getSolrAttributes(this.layerName);
    for (SolrAttribute at : attributes) {
      if (at.isPk()) {
        this.pkField = at.getName();
      }
      if (Geometry.class.isAssignableFrom(at.getType())) {
        at.setSrid(SOURCE_SRID);
      }
      at.setUse(true);
    }
  }