} else if ($this->aViewBox) {
$oCtx->setViewboxFromBox($this->aViewBox, $this->bBoundedSearch);
}
+ if ($this->aExcludePlaceIDs) {
+ $oCtx->setExcludeList($this->aExcludePlaceIDs);
+ }
$sNormQuery = $this->normTerm($this->sQuery);
$sLanguagePrefArraySQL = getArraySQL(
$aPlaceIDs = $oSearch->queryNearbyPoi(
$this->oDB,
$sCountryCodesSQL,
- $this->aExcludePlaceIDs ? join(',', $this->aExcludePlaceIDs) : '',
$this->iLimit
);
} elseif ($oSearch->isOperator(Operator::POSTCODE)) {
$sCountryCodesSQL,
$this->iMinAddressRank,
$this->iMaxAddressRank,
- $this->aExcludePlaceIDs ? join(',', $this->aExcludePlaceIDs) : '',
$this->iLimit
);
$aResult = $oSearch->queryHouseNumber(
$this->oDB,
$aPlaceIDs,
- $this->aExcludePlaceIDs ? join(',', $this->aExcludePlaceIDs) : '',
$this->iLimit
);
$aPlaceIDs = $oSearch->queryPoiByOperator(
$this->oDB,
$aPlaceIDs,
- $this->aExcludePlaceIDs ? join(',', $this->aExcludePlaceIDs) : '',
$this->iLimit
);
}
return chksql($oDB->getCol($sSQL));
}
- public function queryNearbyPoi(&$oDB, $sCountryList, $sExcludeSQL, $iLimit)
+ public function queryNearbyPoi(&$oDB, $sCountryList, $iLimit)
{
if (!$this->sClass) {
return array();
if ($sCountryList) {
$sSQL .= " AND country_code in ($sCountryList)";
}
- if ($sExcludeSQL) {
- $sSQL .= ' AND place_id not in ('.$sExcludeSQL.')';
- }
+ $sSQL .= $this->oContext->excludeSQL(' AND place_id');
if ($this->oContext->sqlViewboxCentre) {
$sSQL .= ' ORDER BY ST_Distance(';
$sSQL .= $this->oContext->sqlViewboxCentre.', ct.centroid) ASC';
if ($sCountryTerm) {
$sSQL .= ' AND '.$sCountryTerm;
}
+ $sSQL .= $this->oContext->excludeSQL(' AND p.place_id');
$sSQL .= " LIMIT $iLimit";
if (CONST_Debug) var_dump($sSQL);
return chksql($oDB->getCol($sSQL));
}
- public function queryNamedPlace(&$oDB, $aWordFrequencyScores, $sCountryList, $iMinAddressRank, $iMaxAddressRank, $sExcludeSQL, $iLimit)
+ public function queryNamedPlace(&$oDB, $aWordFrequencyScores, $sCountryList, $iMinAddressRank, $iMaxAddressRank, $iLimit)
{
$aTerms = array();
$aOrder = array();
}
}
+ $sExcludeSQL = $this->oContext->excludeSQL('place_id');
if ($sExcludeSQL) {
- $aTerms[] = 'place_id not in ('.$sExcludeSQL.')';
+ $aTerms[] = $sExcludeSQL;
}
if ($this->oContext->bViewboxBounded) {
}
- public function queryHouseNumber(&$oDB, $aRoadPlaceIDs, $sExcludeSQL, $iLimit)
+ public function queryHouseNumber(&$oDB, $aRoadPlaceIDs, $iLimit)
{
$sPlaceIDs = join(',', $aRoadPlaceIDs);
$sSQL = 'SELECT place_id FROM placex ';
$sSQL .= 'WHERE parent_place_id in ('.$sPlaceIDs.')';
$sSQL .= " AND transliteration(housenumber) ~* E'".$sHouseNumberRegex."'";
- if ($sExcludeSQL) {
- $sSQL .= ' AND place_id not in ('.$sExcludeSQL.')';
- }
+ $sSQL .= $this->oContext->excludeSQL(' AND place_id');
$sSQL .= " LIMIT $iLimit";
if (CONST_Debug) var_dump($sSQL);
$sSQL .= " or interpolationtype='all') and ";
$sSQL .= $iHousenumber.">=startnumber and ";
$sSQL .= $iHousenumber."<=endnumber";
-
- if ($sExcludeSQL) {
- $sSQL .= ' AND place_id not in ('.$sExcludeSQL.')';
- }
+ $sSQL .= $this->oContext->excludeSQL(' AND place_id');
$sSQL .= " limit $iLimit";
if (CONST_Debug) var_dump($sSQL);
$sSQL = 'SELECT place_id FROM location_property_aux';
$sSQL .= ' WHERE parent_place_id in ('.$sPlaceIDs.')';
$sSQL .= " AND housenumber = '".$this->sHouseNumber."'";
- if ($sExcludeSQL) {
- $sSQL .= " AND place_id not in ($sExcludeSQL)";
- }
+ $sSQL .= $this->oContext->excludeSQL(' AND place_id');
$sSQL .= " limit $iLimit";
if (CONST_Debug) var_dump($sSQL);
$sSQL .= " or interpolationtype='all') and ";
$sSQL .= $iHousenumber.">=startnumber and ";
$sSQL .= $iHousenumber."<=endnumber";
-
- if ($sExcludeSQL) {
- $sSQL .= ' AND place_id not in ('.$sExcludeSQL.')';
- }
+ $sSQL .= $this->oContext->excludeSQL(' AND place_id');
$sSQL .= " limit $iLimit";
if (CONST_Debug) var_dump($sSQL);
}
- public function queryPoiByOperator(&$oDB, $aParentIDs, $sExcludeSQL, $iLimit)
+ public function queryPoiByOperator(&$oDB, $aParentIDs, $iLimit)
{
$sPlaceIDs = join(',', $aParentIDs);
$aClassPlaceIDs = array();
$sSQL .= " AND class='".$this->sClass."' ";
$sSQL .= " AND type='".$this->sType."'";
$sSQL .= " AND linked_place_id is null";
+ $sSQL .= $this->oContext->excludeSQL(' AND place_id');
$sSQL .= " ORDER BY rank_search ASC ";
$sSQL .= " LIMIT $iLimit";
$sSQL .= " WHERE ST_Contains('$sPlaceGeom', l.centroid)";
}
- if ($sExcludeSQL) {
- $sSQL .= ' AND l.place_id not in ('.$sExcludeSQL.')';
- }
+ $sSQL .= $this->oContext->excludeSQL(' AND l.place_id');
$sSQL .= 'limit 300) i ';
if ($sOrderBySQL) {
$sSQL .= 'order by order_term asc';
$sSQL .= " AND ST_DWithin(l.geometry, f.centroid, $fRange)";
$sSQL .= " AND l.class='".$this->sClass."'";
$sSQL .= " AND l.type='".$this->sType."'";
- if ($sExcludeSQL) {
- $sSQL .= " AND l.place_id not in (".$sExcludeSQL.")";
- }
+ $sSQL .= $this->oContext->excludeSQL(' AND l.place_id');
if ($sOrderBySQL) {
$sSQL .= "ORDER BY orderterm ASC";
}