public GetRecordsType GetRecordsFreeTextSearch(string searchString, int startPosition = 1, int limit = 20, bool sortByTitle = false, string outputSchema = "csw:Record") { var filters = new object[] { new PropertyIsLikeType { escapeChar = "\\", singleChar = "_", wildCard = "%", PropertyName = new PropertyNameType { Text = new[] { "AnyText" } }, Literal = new LiteralType { Text = new[] { searchString } } } }; var filterNames = new ItemsChoiceType23[] { ItemsChoiceType23.PropertyIsLike, }; return(GetRecordsWithFilter(filters, filterNames, startPosition, limit, sortByTitle, outputSchema)); }
public GetRecordsType GetRecordsOrganisationMetadataPointOfContactSearch(string searchString, int startPosition = 1, int limit = 20, bool sortByTitle = false) { searchString = searchString.Replace(" ", "_"); var filters = new object[] { new PropertyIsLikeType { escapeChar = "\\", singleChar = "_", wildCard = "%", PropertyName = new PropertyNameType { Text = new[] { "MetadataPointOfContact" } }, Literal = new LiteralType { Text = new[] { searchString } } } }; var filterNames = new ItemsChoiceType23[] { ItemsChoiceType23.PropertyIsLike, }; return(GetRecordsWithFilter(filters, filterNames, startPosition, limit, sortByTitle)); }
public SearchResultsType SearchMetadata(string searchString) { GeoNorge g = new GeoNorge("", "", WebConfigurationManager.AppSettings["GeoNetworkUrl"]); var filters = new object[] { new PropertyIsLikeType { escapeChar = "\\", singleChar = "_", wildCard = "%", PropertyName = new PropertyNameType { Text = new[] { "srv:title" } }, Literal = new LiteralType { Text = new[] { searchString } } } }; var filterNames = new ItemsChoiceType23[] { ItemsChoiceType23.PropertyIsLike, }; var result = g.SearchWithFilters(filters, filterNames, 1, 200, true); return(result); }
public SearchResultsType GetDatasets() { GeoNorge _geoNorge = new GeoNorge("", "", WebConfigurationManager.AppSettings["GeoNetworkUrl"] + geoNetworkendPoint); _geoNorge.OnLogEventDebug += new GeoNorgeAPI.LogEventHandlerDebug(LogEventsDebug); _geoNorge.OnLogEventError += new GeoNorgeAPI.LogEventHandlerError(LogEventsError); var filters = new object[] { new PropertyIsLikeType { escapeChar = "\\", singleChar = "_", wildCard = "%", PropertyName = new PropertyNameType { Text = new[] { "protocol" } }, Literal = new LiteralType { Text = new[] { "GEONORGE:DOWNLOAD" } } } }; var filterNames = new ItemsChoiceType23[] { ItemsChoiceType23.PropertyIsLike, }; var result = _geoNorge.SearchWithFilters(filters, filterNames, 1, 1000, false); return(result); }
private FilterType CreateFilterForNorwayDigital() { var filters = new object[] { new BinaryLogicOpType() { Items = new object[] { new PropertyIsLikeType { escapeChar = "\\", singleChar = "_", wildCard = "%", PropertyName = new PropertyNameType { Text = new[] { "keyword" } }, Literal = new LiteralType { Text = new[] { "Inspire" } } }, new PropertyIsLikeType { PropertyName = new PropertyNameType { Text = new[] { "keyword" } }, Literal = new LiteralType { Text = new[] { "Norge digitalt" } } } }, ItemsElementName = new ItemsChoiceType22[] { ItemsChoiceType22.PropertyIsLike, ItemsChoiceType22.PropertyIsLike, } } }; var filterNames = new ItemsChoiceType23[] { ItemsChoiceType23.Or }; return(new FilterType { Items = filters, ItemsElementName = filterNames }); }
public void ShouldReturnServicesFromKartverket() { var filters = new object[] { new BinaryLogicOpType() { Items = new object[] { new PropertyIsLikeType { escapeChar = "\\", singleChar = "_", wildCard = "%", PropertyName = new PropertyNameType { Text = new[] { "OrganisationName" } }, Literal = new LiteralType { Text = new[] { "%Kartverket%" } } }, new PropertyIsLikeType { PropertyName = new PropertyNameType { Text = new[] { "Type" } }, Literal = new LiteralType { Text = new[] { "service" } } } }, ItemsElementName = new ItemsChoiceType22[] { ItemsChoiceType22.PropertyIsLike, ItemsChoiceType22.PropertyIsLike, } }, }; var filterNames = new ItemsChoiceType23[] { ItemsChoiceType23.And }; var result = _geonorge.SearchWithFilters(filters, filterNames); Assert.Greater(int.Parse(result.numberOfRecordsMatched), 0, "Should have return more than zero datasets from Kartverket."); }
internal GetRecordsType GetRecordsFreeTextOrganisationMetadataPointOfContactSearch(string searchString, string organisationName, int startPosition, int limit, bool sortByTitle) { organisationName = organisationName.Replace(" ", "_"); var filters = new object[] { new BinaryLogicOpType { ItemsElementName = new ItemsChoiceType22[] { ItemsChoiceType22.PropertyIsLike, ItemsChoiceType22.PropertyIsLike }, Items = new object[] { new PropertyIsLikeType { escapeChar = "\\", singleChar = "_", wildCard = "%", PropertyName = new PropertyNameType { Text = new[] { "AnyText" } }, Literal = new LiteralType { Text = new[] { searchString } } }, new PropertyIsLikeType { escapeChar = "\\", singleChar = "_", wildCard = "%", PropertyName = new PropertyNameType { Text = new[] { "MetadataPointOfContact" } }, Literal = new LiteralType { Text = new[] { organisationName } } } } } }; var filterNames = new ItemsChoiceType23[] { ItemsChoiceType23.And }; return(GetRecordsWithFilter(filters, filterNames, startPosition, limit, sortByTitle)); }
public SearchResultsType GetDatasets() { GeoNorge _geoNorge = new GeoNorge("", "", WebConfigurationManager.AppSettings["GeoNetworkUrl"] + geoNetworkendPoint); _geoNorge.OnLogEventDebug += new GeoNorgeAPI.LogEventHandlerDebug(LogEventsDebug); _geoNorge.OnLogEventError += new GeoNorgeAPI.LogEventHandlerError(LogEventsError); var filters = new object[] { new PropertyIsLikeType { escapeChar = "\\", singleChar = "_", wildCard = "%", PropertyName = new PropertyNameType { Text = new[] { "keyword" } }, Literal = new LiteralType { Text = new[] { "fellesDatakatalog" } } } }; var filterNames = new ItemsChoiceType23[] { ItemsChoiceType23.PropertyIsLike, }; var stopwatch = new Stopwatch(); stopwatch.Start(); var result = _geoNorge.SearchWithFilters(filters, filterNames, 1, 1000, false); stopwatch.Stop(); Log.Debug($"Looking up metadata from GeonorgeApi [timespent={stopwatch.ElapsedMilliseconds}ms]"); return(result); }
private FilterType CreateFilterForServices() { var filters = new object[] { new PropertyIsLikeType { escapeChar = "\\", singleChar = "_", wildCard = "%", PropertyName = new PropertyNameType {Text = new[] {"type"}}, Literal = new LiteralType {Text = new[] { "service" }} } }; var filterNames = new ItemsChoiceType23[] { ItemsChoiceType23.PropertyIsLike, }; return new FilterType { Items = filters, ItemsElementName = filterNames }; }
/// <summary> /// Search for records with an arbitrary number of filters. /// </summary> /// <param name="filters">See www.opengis.net.FilterType for the type objects that are accepted</param> /// <param name="filterNames">Array of names corresponding to the index in filters, see www.opengis.net.ItemsChoiceType23 for possible values</param> /// <param name="startPosition">Search offset for pagination of results</param> /// <param name="limit">Maximum number of records to return</param> /// <param name="sortByTitle">Sort results by title, default value is false</param> /// <returns>Results returned in Dublin Core format (www.opengis.net.RecordType objects).</returns> public SearchResultsType SearchWithFilters(object[] filters, ItemsChoiceType23[] filterNames, int startPosition = 1, int limit = 20, bool sortByTitle = false) { GetRecordsType request = _requestFactory.GetRecordsWithFilter(filters, filterNames, startPosition, limit, sortByTitle); return _requestRunner.RunGetRecordsRequest(request).SearchResults; }
public void ShouldReturnServicesFromKartverket() { var filters = new object[] { new BinaryLogicOpType() { Items = new object[] { new PropertyIsLikeType { escapeChar = "\\", singleChar = "_", wildCard = "%", PropertyName = new PropertyNameType {Text = new[] {"OrganisationName"}}, Literal = new LiteralType {Text = new[] { "%Kartverket%" }} }, new PropertyIsLikeType { PropertyName = new PropertyNameType {Text = new[] {"Type"}}, Literal = new LiteralType {Text = new[] { "service" }} } }, ItemsElementName = new ItemsChoiceType22[] { ItemsChoiceType22.PropertyIsLike, ItemsChoiceType22.PropertyIsLike, } }, }; var filterNames = new ItemsChoiceType23[] { ItemsChoiceType23.And }; var result = _geonorge.SearchWithFilters(filters, filterNames); Assert.Greater(int.Parse(result.numberOfRecordsMatched), 0, "Should have return more than zero datasets from Kartverket."); }
private static void SearchForServicesFromKartverket() { var searchFilter = new object[] { new BinaryLogicOpType() { Items = new object[] { new PropertyIsLikeType { PropertyName = new PropertyNameType {Text = new[] {"OrganisationName"}}, Literal = new LiteralType {Text = new[] { "Kartverket" }} }, new PropertyIsLikeType { PropertyName = new PropertyNameType {Text = new[] {"Type"}}, Literal = new LiteralType {Text = new[] { "service" }} } }, ItemsElementName = new ItemsChoiceType22[] { ItemsChoiceType22.PropertyIsLike, ItemsChoiceType22.PropertyIsLike, } }, }; var searchFilterNames = new ItemsChoiceType23[] { ItemsChoiceType23.And }; SearchResultsType searchResults = _api.SearchWithFilters(searchFilter, searchFilterNames); List<CswMetadataEntry> metadataEntries = ParseSearchResults(searchResults); metadataEntries.ForEach(System.Console.WriteLine); }