[Mapbender-commits] r10039 - trunk/mapbender/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Jan 23 04:47:43 PST 2019


Author: armin11
Date: 2019-01-23 04:47:43 -0800 (Wed, 23 Jan 2019)
New Revision: 10039

Modified:
   trunk/mapbender/http/php/mod_callCswMetadata.php
Log:
Fix to allow search with text query

Modified: trunk/mapbender/http/php/mod_callCswMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_callCswMetadata.php	2019-01-23 10:11:38 UTC (rev 10038)
+++ trunk/mapbender/http/php/mod_callCswMetadata.php	2019-01-23 12:47:43 UTC (rev 10039)
@@ -473,12 +473,17 @@
 //begin main program
 //************************************************************************************
 $queryString  = $searchText;
-$queryStringParts = explode("+",$queryString);
+$queryStringParts = explode(" ",$queryString);
 $queryText = $queryStringParts[0];
-
+if ($queryText == '*') {
+	$queryText = '';
+}
 //TODO query	
+$fullTextFilter = '<ogc:PropertyIsLike wildCard="%" singleChar="_" escapeChar="">';
+$fullTextFilter .= '<ogc:PropertyName>AnyText</ogc:PropertyName>';
+$fullTextFilter .= '<ogc:Literal>%'.$queryText.'%</ogc:Literal>';
+$fullTextFilter .= '</ogc:PropertyIsLike>';
 
-
 $existsSpatialFilter = false;
 $searchBboxArray = explode(",", $searchBbox);
 if ($searchBbox !== NULL) {
@@ -515,6 +520,14 @@
 		$spatialFilter .= "/<ogc:BBOX>";
     }
 }
+//combine filter
+if ($existsSpatialFilter == true){
+    $additionalFilter = "<And>".$fullTextFilter.$spatialFilter."</And>";
+} else {
+    $additionalFilter = $fullTextFilter;
+}
+
+
 //csw Id = catalogueId
 $csw = new csw();
 $csw->createCatObjFromDB($catalogueId);
@@ -529,11 +542,6 @@
 //$e = new mb_exception("catalogue id = ".$cswId);
 //map paging to results
 
-if ($existsSpatialFilter == true){
-    $additionalFilter = $spatialFilter;
-} else {
-    $additionalFilter = false;
-}
 $recordType = $searchResources;
 
 //log start time for counting elements via csw
@@ -642,15 +650,15 @@
 				$resultObject->{$searchResource}->srv[$k-1]->mdLink = $csw->cat_op_values['getrecordbyid']['get']."?request=GetRecordById&service=CSW&version=2.0.2&Id=".$fileIdentifier."&ElementSetName=full&OUTPUTSCHEMA=http://www.isotc211.org/2005/gmd";
 			}
 			//html view
-			$resultObject->{$searchResource}->srv[$k-1]->htmlLink = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."/../mod_exportIso19139.php?".urlencode($resultObject->{$searchResource}->srv[$k-1]->mdLink);
-
+			if ($_SERVER['HTTPS'] !== '') {
+				$scheme = "https";
+			} else {
+				$scheme = "http";
+			}
+			$resultObject->{$searchResource}->srv[$k-1]->htmlLink = $scheme.'://'.$_SERVER['HTTP_HOST'].str_replace(basename($_SERVER['SCRIPT_NAME']), "mod_exportIso19139.php", $_SERVER['PHP_SELF'])."?url=".urlencode($resultObject->{$searchResource}->srv[$k-1]->mdLink);
 			//service urls if available 
 			//type of service
 			//inspire url for service
-			
-			
-
-			
 			$url =  $cswClient->operationResult->xpath('/csw:GetRecordsResponse/csw:SearchResults/gmd:MD_Metadata['.$k.']/gmd:distributionInfo/gmd:MD_Distribution/gmd:transferOptions/gmd:MD_DigitalTransferOptions/gmd:onLine/gmd:CI_OnlineResource/gmd:linkage/gmd:URL');
 			$url = (string)$url[0];
 			if (isset($url) && $url !=="") {



More information about the Mapbender_commits mailing list