+
+ public getRank()
+ {
+ return $this->iSearchRank;
+ }
+
+ /**
+ * Set the geographic search radius.
+ */
+ public setNear(&$oNearPoint)
+ {
+ $this->oNearPoint = $oNearPoint;
+ }
+
+ public setPoiSearch($iOperator, $sClass, $sType)
+ {
+ $this->iOperator = $iOperator;
+ $this->sClass = $sClass;
+ $this->sType = $sType;
+ }
+
+ public hasOperator()
+ {
+ return $this->iOperator != Operator::NONE;
+ }
+
+ /**
+ * Extract special terms from the query, amend the search
+ * and return the shortended query.
+ *
+ * Only the first special term found will be used but all will
+ * be removed from the query.
+ */
+ public extractKeyValuePairs(&$oDB, $sQuery)
+ {
+ // Search for terms of kind [<key>=<value>].
+ preg_match_all(
+ '/\\[([\\w_]*)=([\\w_]*)\\]/',
+ $sQuery,
+ $aSpecialTermsRaw,
+ PREG_SET_ORDER
+ );
+
+ foreach ($aSpecialTermsRaw as $aTerm) {
+ $sQuery = str_replace($aTerm[0], ' ', $sQuery);
+ if (!$this->hasOperator()) {
+ $this->setPoiSearch(Operator::TYPE, $aTerm[1], $aTerm[2]);
+ }
+ }
+
+ return $sQuery;
+ }