public virtual string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier) { string geom = null; if (item is Feature) geom = WktExtensions.ToWkt((Feature)item); if (geom == null) { foreach (SyndicationElementExtension ext in item.ElementExtensions) { if (ext.OuterName == "spatial") { geom = ext.GetObject<string>(); break; } } } if (geom == null) { foreach (SyndicationElementExtension ext in item.ElementExtensions.ToArray()) { if (ext.OuterNamespace == "http://www.georss.org/georss/10" ) geom = Terradue.GeoJson.GeoRss10.GeoRss10Extensions.ToGeometry(Terradue.GeoJson.GeoRss10.GeoRss10Helper.Deserialize(ext.GetReader())).ToWkt(); if (ext.OuterNamespace == "http://www.georss.org/georss" ) geom = Terradue.GeoJson.GeoRss.GeoRssExtensions.ToGeometry(Terradue.GeoJson.GeoRss.GeoRssHelper.Deserialize(ext.GetReader())).ToWkt(); } } return geom; }
public static Terradue.GeoJson.Gml.AbstractGeometryType FeatureToGml(Terradue.GeoJson.Feature.Feature feature) { if (feature.Geometry is Point) { return GeometryToGml((Point)feature.Geometry); } if (feature.Geometry is MultiPoint) { return GeometryToGml((MultiPoint)feature.Geometry); } if (feature.Geometry is LineString) { return GeometryToGml((LineString)feature.Geometry); } if (feature.Geometry is MultiLineString) { return GeometryToGml((MultiLineString)feature.Geometry); } if (feature.Geometry is Polygon) { return GeometryToGml((Polygon)feature.Geometry); } if (feature.Geometry is MultiPolygon) { return GeometryToGml((MultiPolygon)feature.Geometry); } return null; }
public virtual string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier) { string title = ""; if (item.Title != null) title = item.Title.Text; return title; }
public override string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier) { string date = base.GetMetadata(item, specifier); var start = Terradue.Metadata.EarthObservation.OpenSearch.EarthObservationOpenSearchResultHelpers.FindEndDateFromOpenSearchResultItem(item); if (start != DateTime.MinValue) date = start.ToUniversalTime().ToString("O"); return date; }
public override string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier) { string ident = base.GetMetadata(item, specifier); if (ident == null) { var identifier = Terradue.Metadata.EarthObservation.OpenSearch.EarthObservationOpenSearchResultHelpers.FindIdentifierFromOpenSearchResultItem(item); if (identifier != null) ident = identifier; } return ident; }
public override string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier) { string geom = base.GetMetadata(item, specifier); if (geom == null) { var geometry = Terradue.Metadata.EarthObservation.OpenSearch.EarthObservationOpenSearchResultHelpers.FindGeometryFromEarthObservation(item); if (geometry != null) geom = geometry.ToWkt(); } return geom; }
public FeatureResult(Terradue.GeoJson.Feature.Feature feature) : base(feature.Geometry, feature.Properties) { base.Id = feature.Id; base.BoundingBoxes = feature.BoundingBoxes; base.CRS = feature.CRS; links = new Collection<SyndicationLink>(); elementExtensions = new SyndicationElementExtensionCollection(); Properties = feature.Properties; authors = new Collection<SyndicationPerson>(); categories = new Collection<SyndicationCategory>(); contributors = new Collection<SyndicationPerson>(); }
public virtual string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier) { string ident = null; if (ident == null) { foreach (SyndicationElementExtension ext in item.ElementExtensions) { if (ext.OuterName == "identifier") { ident = ext.GetObject<string>(); break; } } } return ident; }
public static Terradue.ServiceModel.Ogc.Eop21.EarthObservationType EarthExplorerToEo(Terradue.OpenSearch.Model.Schemas.EarthExplorer.scene scene) { if (scene.metadataFields.FirstOrDefault(m => m.name == "Landsat Scene Identifier") != null) { return LandsatToEo(scene); } if (scene.metadataFields.FirstOrDefault(m => m.name == "Entity ID" && m.metadataValue.StartsWith("SRTM")) != null) { return SRTMToEo(scene); } return null; }
public FeatureCollectionResult(Terradue.GeoJson.Feature.FeatureCollection fc) : base() { base.BoundingBoxes = fc.BoundingBoxes; base.CRS = fc.CRS; base.Properties = fc.Properties; Links = new Collection<SyndicationLink>(); fc.Features.FirstOrDefault(f => { FeatureResults.Add(new FeatureResult(f)); return false; }); elementExtensions = new SyndicationElementExtensionCollection(); authors = new Collection<SyndicationPerson>(); categories = new Collection<SyndicationCategory>(); contributors = new Collection<SyndicationPerson>(); }
public string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier) { var link = item.Links.FirstOrDefault(l => { if (l.RelationshipType == "enclosure") { bool ret = true; return ret; } return false; }); if (link != null) return link.Uri.ToString(); return ""; }
public static Terradue.Metadata.EarthObservation.Extra.orbitListType GetS1OrbitsFromEE(Terradue.OpenSearch.SciHub.Data.Earth_Explorer_File file) { Terradue.Metadata.EarthObservation.Extra.orbitListType orbits = new Terradue.Metadata.EarthObservation.Extra.orbitListType(); orbits.orbit = file.Data_Block.List_of_OSVs.OSV. Select<Terradue.OpenSearch.SciHub.Data.Earth_Explorer_FileData_BlockList_of_OSVsOSV, Terradue.Metadata.EarthObservation.Extra.orbitType>(o => { Terradue.Metadata.EarthObservation.Extra.orbitType orbit = new Terradue.Metadata.EarthObservation.Extra.orbitType(); orbit.time = DateTime.SpecifyKind(DateTime.Parse(o.UTC.Replace("UTC=", "")), DateTimeKind.Utc); orbit.frame = Terradue.Metadata.EarthObservation.Extra.referenceFrameType.EarthFixed; orbit.absoluteOrbit = int.Parse(o.Absolute_Orbit.Replace("+", "")); orbit.position = new double[] { o.X.Value, o.Y.Value, o.Z.Value }; orbit.velocity = new double[] { o.VX.Value, o.VY.Value, o.VZ.Value }; return orbit; }).ToArray(); return orbits; }
public virtual string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier) { string date = null; if (date == null) { foreach (SyndicationElementExtension ext in item.ElementExtensions) { if (ext.OuterName == "date") { date = ext.GetObject<string>(); if (date.Contains("/")) date = DateTime.Parse(date.Split('/')[1]).ToUniversalTime().ToString("O"); break; } if (ext.OuterName == "dtend" && ext.OuterNamespace == "http://www.w3.org/2002/12/cal/ical#") { date = DateTime.Parse(ext.GetObject<string>()).ToUniversalTime().ToString("O"); break; } } } return date; }
public static Terradue.ServiceModel.Ogc.Eop21.EarthObservationType SRTMToEo(Terradue.OpenSearch.Model.Schemas.EarthExplorer.scene scene) { throw new NotImplementedException(); }
public ExtendedFeature(Terradue.GeoJson.Geometry.GeometryObject geom, Dictionary<string, object> prop ) : base(geom, prop) { }
public static SyndicationElementExtension GenerateOrbitsExtension(Terradue.OpenSearch.SciHub.Data.Earth_Explorer_File file) { SyndicationElementExtension extension = new SyndicationElementExtension(GetS1OrbitsFromEE(file), Terradue.Metadata.EarthObservation.Extra.orbitListType.OrbitsSerializer); return extension; }
public virtual string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier) { DateTime date = Terradue.Metadata.EarthObservation.OpenSearch.EarthObservationOpenSearchResultHelpers.FindStartDateFromOpenSearchResultItem(item); return date.ToUniversalTime().ToString("O"); }
public QuerySettings GetQuerySettings(Terradue.OpenSearch.Engine.OpenSearchEngine ose) { IOpenSearchEngineExtension osee = new AtomOpenSearchEngineExtension(); return new QuerySettings(osee.DiscoveryContentType, osee.ReadNative); }
public void ApplyResultFilters(Terradue.OpenSearch.Request.OpenSearchRequest request, ref Terradue.OpenSearch.Result.IOpenSearchResultCollection osr, string finalContentType) { }
public virtual string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier) { return item.PublishDate.ToUniversalTime().ToString("O"); }
public static Terradue.ServiceModel.Ogc.Opt21.OptEarthObservationType LandsatToEo(Terradue.OpenSearch.Model.Schemas.EarthExplorer.scene scene) { Terradue.ServiceModel.Ogc.Opt21.OptEarthObservationType optEo = new Terradue.ServiceModel.Ogc.Opt21.OptEarthObservationType(); List<Terradue.ServiceModel.Ogc.Eop21.SpecificInformationPropertyType> vs = new List<Terradue.ServiceModel.Ogc.Eop21.SpecificInformationPropertyType>(); optEo.EopMetaDataProperty = new Terradue.ServiceModel.Ogc.Eop21.EarthObservationMetaDataPropertyType(); optEo.EopMetaDataProperty.EarthObservationMetaData = new Terradue.ServiceModel.Ogc.Eop21.EarthObservationMetaDataType(); var identifier = scene.metadataFields.FirstOrDefault(m => m.name == "Landsat Scene Identifier"); optEo.EopMetaDataProperty.EarthObservationMetaData.identifier = identifier.metadataValue; optEo.procedure = new Terradue.ServiceModel.Ogc.Om.OM_ProcessPropertyType(); optEo.procedure.Eop21EarthObservationEquipment = new Terradue.ServiceModel.Ogc.Eop21.EarthObservationEquipmentType(); optEo.procedure.Eop21EarthObservationEquipment.platform = new Terradue.ServiceModel.Ogc.Eop21.PlatformPropertyType(); optEo.procedure.Eop21EarthObservationEquipment.platform.Platform = new Terradue.ServiceModel.Ogc.Eop21.PlatformType(); optEo.procedure.Eop21EarthObservationEquipment.platform.Platform.shortName = "Landsat-" + identifier.metadataValue.Substring(2, 1); optEo.procedure.Eop21EarthObservationEquipment.platform.Platform.orbitType = Terradue.ServiceModel.Ogc.Eop21.OrbitTypeValueType.LEO; optEo.procedure.Eop21EarthObservationEquipment.instrument = new Terradue.ServiceModel.Ogc.Eop21.InstrumentPropertyType(); optEo.procedure.Eop21EarthObservationEquipment.instrument.Instrument = new Terradue.ServiceModel.Ogc.Eop21.InstrumentType(); switch (identifier.metadataValue.Substring(1, 1)) { case "T": optEo.procedure.Eop21EarthObservationEquipment.instrument.Instrument.shortName = "TIRS"; optEo.procedure.Eop21EarthObservationEquipment.instrument.Instrument.description = "Thermal Infrared Sensor"; break; case "O": optEo.procedure.Eop21EarthObservationEquipment.instrument.Instrument.shortName = "OLI"; optEo.procedure.Eop21EarthObservationEquipment.instrument.Instrument.description = "Operational Land Imager"; break; case "C": optEo.procedure.Eop21EarthObservationEquipment.instrument.Instrument.shortName = "OLI_TIRS"; optEo.procedure.Eop21EarthObservationEquipment.instrument.Instrument.description = "Operational Land Imager & Thermal Infrared Sensor"; break; } optEo.procedure.Eop21EarthObservationEquipment.sensor = new Terradue.ServiceModel.Ogc.Eop21.SensorPropertyType(); optEo.procedure.Eop21EarthObservationEquipment.sensor.Sensor = new Terradue.ServiceModel.Ogc.Eop21.SensorType(); optEo.procedure.Eop21EarthObservationEquipment.sensor.Sensor.sensorType = "OPTICAL"; optEo.procedure.Eop21EarthObservationEquipment.acquisitionParameters = new Terradue.ServiceModel.Ogc.Eop21.AcquisitionPropertyType(); optEo.procedure.Eop21EarthObservationEquipment.acquisitionParameters.Acquisition = new Terradue.ServiceModel.Ogc.Eop21.AcquisitionType(); var swrsRow = scene.metadataFields.FirstOrDefault(m => m.name == "Target WRS Row"); if (swrsRow != null) { int wrsRow = int.Parse(swrsRow.metadataValue); if (wrsRow > 1 && wrsRow <= 122) optEo.procedure.Eop21EarthObservationEquipment.acquisitionParameters.Acquisition.orbitDirection = Terradue.ServiceModel.Ogc.Eop21.OrbitDirectionValueType.DESCENDING; if (wrsRow >= 123 && wrsRow <= 246) optEo.procedure.Eop21EarthObservationEquipment.acquisitionParameters.Acquisition.orbitDirection = Terradue.ServiceModel.Ogc.Eop21.OrbitDirectionValueType.ASCENDING; if (wrsRow >= 247 && wrsRow <= 248) optEo.procedure.Eop21EarthObservationEquipment.acquisitionParameters.Acquisition.orbitDirection = Terradue.ServiceModel.Ogc.Eop21.OrbitDirectionValueType.DESCENDING; optEo.procedure.Eop21EarthObservationEquipment.acquisitionParameters.Acquisition.orbitDirectionSpecified = true; optEo.procedure.Eop21EarthObservationEquipment.acquisitionParameters.Acquisition.wrsLatitudeGrid = new Terradue.ServiceModel.Ogc.Gml321.CodeWithAuthorityType(); optEo.procedure.Eop21EarthObservationEquipment.acquisitionParameters.Acquisition.wrsLatitudeGrid.Value = wrsRow.ToString(); } var swrsPath = scene.metadataFields.FirstOrDefault(m => m.name == "Target WRS Path"); if (swrsPath != null) { optEo.procedure.Eop21EarthObservationEquipment.acquisitionParameters.Acquisition.wrsLongitudeGrid = new Terradue.ServiceModel.Ogc.Gml321.CodeWithAuthorityType(); optEo.procedure.Eop21EarthObservationEquipment.acquisitionParameters.Acquisition.wrsLongitudeGrid.Value = swrsPath.metadataValue.Trim(); } var fullscene = scene.metadataFields.FirstOrDefault(m => m.name == "Full or Partial Scene"); if (fullscene != null) { Terradue.ServiceModel.Ogc.Eop21.SpecificInformationPropertyType vss = new Terradue.ServiceModel.Ogc.Eop21.SpecificInformationPropertyType(); vss.SpecificInformation = new Terradue.ServiceModel.Ogc.Eop21.SpecificInformationType(); vss.SpecificInformation.localAttribute = "full_partial_scene"; vss.SpecificInformation.localValue = fullscene.metadataValue; } var dataCat = scene.metadataFields.FirstOrDefault(m => m.name == "Data Category"); if (dataCat != null) { switch (dataCat.metadataValue) { case "NOMINAL": optEo.EopMetaDataProperty.EarthObservationMetaData.acquisitionType = Terradue.ServiceModel.Ogc.Eop21.AcquisitionTypeValueType.NOMINAL; break; case "EXCHANGE": optEo.EopMetaDataProperty.EarthObservationMetaData.acquisitionType = Terradue.ServiceModel.Ogc.Eop21.AcquisitionTypeValueType.OTHER; break; case "TEST": optEo.EopMetaDataProperty.EarthObservationMetaData.acquisitionType = Terradue.ServiceModel.Ogc.Eop21.AcquisitionTypeValueType.OTHER; break; case "ENGINEERING": optEo.EopMetaDataProperty.EarthObservationMetaData.acquisitionType = Terradue.ServiceModel.Ogc.Eop21.AcquisitionTypeValueType.OTHER; break; case "VALIDATION": optEo.EopMetaDataProperty.EarthObservationMetaData.acquisitionType = Terradue.ServiceModel.Ogc.Eop21.AcquisitionTypeValueType.CALIBRATION; break; } } optEo.EopMetaDataProperty.EarthObservationMetaData.processing = new Terradue.ServiceModel.Ogc.Eop21.ProcessingInformationPropertyType[1]; optEo.EopMetaDataProperty.EarthObservationMetaData.processing[0] = new Terradue.ServiceModel.Ogc.Eop21.ProcessingInformationPropertyType(); optEo.EopMetaDataProperty.EarthObservationMetaData.processing[0].ProcessingInformation = new Terradue.ServiceModel.Ogc.Eop21.ProcessingInformationType(); var level1 = scene.metadataFields.FirstOrDefault(m => m.name == "Data Type Level 1"); if (level1 != null) { optEo.EopMetaDataProperty.EarthObservationMetaData.processing[0].ProcessingInformation.processingLevel = level1.metadataValue; } List<string> aux = new List<string>(); var bpfoli = scene.metadataFields.FirstOrDefault(m => m.name == "Bias Parameter File Name OLI"); if (bpfoli != null) { aux.Add(bpfoli.metadataValue); } var bpftirs = scene.metadataFields.FirstOrDefault(m => m.name == "Bias Parameter File Name TIRS"); if (bpftirs != null) { aux.Add(bpftirs.metadataValue); } var bpfcal = scene.metadataFields.FirstOrDefault(m => m.name == "Calibration Parameter File"); if (bpfcal != null) { aux.Add(bpfcal.metadataValue); } var bpfrlut = scene.metadataFields.FirstOrDefault(m => m.name == "RLUT File Name"); if (bpfrlut != null) { aux.Add(bpfrlut.metadataValue); } optEo.EopMetaDataProperty.EarthObservationMetaData.processing[0].ProcessingInformation.auxiliaryDataSetFileName = aux.ToArray(); optEo.phenomenonTime = new Terradue.ServiceModel.Ogc.Om.TimeObjectPropertyType(); optEo.phenomenonTime.GmlTimePeriod = new Terradue.ServiceModel.Ogc.Gml321.TimePeriodType(); var start = scene.metadataFields.FirstOrDefault(m => m.name == "Start Time"); var stop = scene.metadataFields.FirstOrDefault(m => m.name == "Stop Time"); if (start != null) { DateTime startdate = ParseDateTime(start.metadataValue); optEo.phenomenonTime.GmlTimePeriod.beginPosition = new Terradue.ServiceModel.Ogc.Gml321.TimePositionType(); optEo.phenomenonTime.GmlTimePeriod.beginPosition.Value = startdate.ToString("O"); } if (stop != null) { DateTime stopdate = ParseDateTime(stop.metadataValue); optEo.phenomenonTime.GmlTimePeriod.endPosition = new Terradue.ServiceModel.Ogc.Gml321.TimePositionType(); optEo.phenomenonTime.GmlTimePeriod.endPosition.Value = stopdate.ToString("O"); } optEo.EopMetaDataProperty.EarthObservationMetaData.vendorSpecific = vs.ToArray(); var qua = scene.metadataFields.FirstOrDefault(m => m.name == "Image Quality"); if (qua != null) { optEo.EopMetaDataProperty.EarthObservationMetaData.imageQualityDegradation = new Terradue.ServiceModel.Ogc.Gml321.MeasureType(); optEo.EopMetaDataProperty.EarthObservationMetaData.imageQualityDegradation.Value = double.Parse(qua.metadataValue); } optEo.result = new Terradue.ServiceModel.Ogc.Opt21.OptEarthObservationResultPropertyType(); optEo.result.Opt21EarthObservationResult = new Terradue.ServiceModel.Ogc.Opt21.OptEarthObservationResultType(); var cc = scene.metadataFields.FirstOrDefault(m => m.name == "Scene Cloud Cover"); double ccd; if (cc != null && double.TryParse(cc.metadataValue, out ccd)) { optEo.result.Opt21EarthObservationResult.cloudCoverPercentage = new Terradue.ServiceModel.Ogc.Gml321.MeasureType(); optEo.result.Opt21EarthObservationResult.cloudCoverPercentage.Value = ccd; } var sunelev = scene.metadataFields.FirstOrDefault(m => m.name == "Sun Elevation"); if (sunelev != null) { optEo.procedure.Eop21EarthObservationEquipment.acquisitionParameters.Acquisition.illuminationElevationAngle = new Terradue.ServiceModel.Ogc.Gml321.AngleType(); optEo.procedure.Eop21EarthObservationEquipment.acquisitionParameters.Acquisition.illuminationElevationAngle.Value = double.Parse(sunelev.metadataValue); } var sunazimuth = scene.metadataFields.FirstOrDefault(m => m.name == "Sun Azimuth"); if (sunazimuth != null) { optEo.procedure.Eop21EarthObservationEquipment.acquisitionParameters.Acquisition.illuminationAzimuthAngle = new Terradue.ServiceModel.Ogc.Gml321.AngleType(); optEo.procedure.Eop21EarthObservationEquipment.acquisitionParameters.Acquisition.illuminationAzimuthAngle.Value = double.Parse(sunazimuth.metadataValue); } var brwexist = scene.metadataFields.FirstOrDefault(m => m.name == "Browse Exists"); if (brwexist != null && brwexist.metadataValue == "Y") { if (scene.overlayLinks.Count() > 0) { var overlay = scene.overlayLinks.FirstOrDefault(l => l.caption.Contains("Natural")); if (overlay != null) { optEo.result.Opt21EarthObservationResult.browse = new Terradue.ServiceModel.Ogc.Eop21.BrowseInformationPropertyType[1]; optEo.result.Opt21EarthObservationResult.browse[0] = new Terradue.ServiceModel.Ogc.Eop21.BrowseInformationPropertyType(); optEo.result.Opt21EarthObservationResult.browse[0].BrowseInformation = new Terradue.ServiceModel.Ogc.Eop21.BrowseInformationType(); var wmsparams = overlay.overlayLink.Split('&'); if (wmsparams.Count() > 0 && wmsparams.FirstOrDefault(p => p.StartsWith("srs=")) != null) { optEo.result.Opt21EarthObservationResult.browse[0].BrowseInformation.referenceSystemIdentifier = new Terradue.ServiceModel.Ogc.Gml321.CodeWithAuthorityType(); optEo.result.Opt21EarthObservationResult.browse[0].BrowseInformation.referenceSystemIdentifier.Value = wmsparams.FirstOrDefault(p => p.StartsWith("srs=")).Split('=')[1]; } optEo.result.Opt21EarthObservationResult.browse[0].BrowseInformation.fileName = new Terradue.ServiceModel.Ogc.Eop21.BrowseInformationTypeFileName(); optEo.result.Opt21EarthObservationResult.browse[0].BrowseInformation.fileName.ServiceReference = new Terradue.ServiceModel.Ogc.Ows.ServiceReferenceType(); optEo.result.Opt21EarthObservationResult.browse[0].BrowseInformation.fileName.ServiceReference.href = overlay.overlayLink; optEo.result.Opt21EarthObservationResult.browse[0].BrowseInformation.type = "img"; optEo.result.Opt21EarthObservationResult.browse[0].BrowseInformation.fileName.ServiceReference.title = overlay.caption; optEo.result.Opt21EarthObservationResult.browse[0].BrowseInformation.fileName.ServiceReference.type = "image/png"; } } } return optEo; }
private static void AddIMGOffering(Terradue.ServiceModel.Ogc.Eop21.EarthObservationType eo, IOpenSearchResultItem item) { Terradue.ServiceModel.Ogc.Eop21.BrowseInformationPropertyType[] bi = null; if (eo.result != null && eo.result.Eop21EarthObservationResult.browse != null) { bi = eo.result.Eop21EarthObservationResult.browse; } if (bi != null) { foreach (var browse in bi) { if (browse.BrowseInformation.type != "img") continue; OwcOffering offering = new OwcOffering(); offering.Code = "http://www.opengis.net/spec/owc-atom/1.0/req/img"; offering.Contents = new OwcContent[1]; offering.Contents[0] = new OwcContent(); offering.Contents[0].Url = new Uri(browse.BrowseInformation.fileName.ServiceReference.href); item.ElementExtensions.Add(offering, new XmlSerializer(typeof(OwcOffering))); } } }
internal IndexInformation CreateCatalogueIndex(Terradue.ElasticCas.Request.CreateIndexRequest createRequest, bool destroy = false) { if (client.IndexExists(i => i.Index(createRequest.IndexName)).Exists) { if (destroy) { client.DeleteIndex(d => d.Index(createRequest.IndexName)); } else { throw new InvalidOperationException(string.Format("'{0}' index already exists and cannot be overriden without data loss", createRequest.IndexName)); } } var response = client.CreateIndex(c => c.Index(createRequest.IndexName)); IndexInformation indexInformation = new IndexInformation(); var status = client.Status(s => s.Index(createRequest.IndexName)); indexInformation.Name = createRequest.IndexName; indexInformation.Shards = status.Shards; indexInformation.Mappings = new Dictionary<string, ICollection<PropertyNameMarker>>(); // Init mappings for each types declared if (createRequest.TypeNames == null || createRequest.TypeNames.Length == 0) { List<string> typeNames = new List<string>(); foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes (typeof(IOpenSearchableElasticType))) { IOpenSearchableElasticType type = (IOpenSearchableElasticType)node.CreateInstance(); if (type is GenericJsonOpenSearchable) continue; IndexNameMarker indexName = new IndexNameMarker(); indexName.Name = createRequest.IndexName; PutMappingRequest putMappingRequest = new PutMappingRequest(indexName, type.Type); ((IPutMappingRequest)putMappingRequest).Mapping = type.GetRootMapping(); client.Map(putMappingRequest); indexInformation.Mappings.Add(type.Identifier, ((IPutMappingRequest)putMappingRequest).Mapping.Properties.Keys); typeNames.Add(type.Type.Name); } createRequest.TypeNames = typeNames.ToArray(); } else { foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes (typeof(IElasticItem))) { IOpenSearchableElasticType type = (IOpenSearchableElasticType)node.CreateInstance(); foreach (string typeName in createRequest.TypeNames) { if (typeName == type.Type.Name) { PutMappingRequest putMappingRequest = new PutMappingRequest(type.Index, type.Type); ((IPutMappingRequest)putMappingRequest).Mapping = type.GetRootMapping(); client.Map(putMappingRequest); indexInformation.Mappings.Add(type.Identifier, ((IPutMappingRequest)putMappingRequest).Mapping.Properties.Keys); } } } } return indexInformation; }
public override string GetMetadata(Terradue.OpenSearch.Result.IOpenSearchResultItem item, string specifier) { return item.Id; }
public void LoadOpenSearchResultCollection(Terradue.OpenSearch.Result.IOpenSearchResultCollection osr) { this.osr = osr; }