errors in structured queries

This commit is contained in:
Brian Quinion
2013-09-02 17:23:31 +01:00
parent 6a337f13d0
commit 624e135a83

View File

@@ -465,7 +465,7 @@
// Commas are used to reduce the search space by indicating where phrases split // Commas are used to reduce the search space by indicating where phrases split
if ($this->aStructuredQuery) if ($this->aStructuredQuery)
{ {
$aPhrases = $aStructuredQuery; $aPhrases = $this->aStructuredQuery;
$bStructuredPhrases = true; $bStructuredPhrases = true;
} }
else else
@@ -1317,10 +1317,10 @@
$sSQL = "select place_id from placex where place_id in (".join(',',$aResultPlaceIDs).") "; $sSQL = "select place_id from placex where place_id in (".join(',',$aResultPlaceIDs).") ";
$sSQL .= "and (placex.rank_address between $this->iMinAddressRank and $this->iMaxAddressRank "; $sSQL .= "and (placex.rank_address between $this->iMinAddressRank and $this->iMaxAddressRank ";
if (14 >= $this->iMinAddressRank && 14 <= $this->iMaxAddressRank) $sSQL .= " OR (extratags->'place') = 'city'"; if (14 >= $this->iMinAddressRank && 14 <= $this->iMaxAddressRank) $sSQL .= " OR (extratags->'place') = 'city'";
if ($aAddressRankList) $sSQL .= " OR placex.rank_address in (".join(',',$aAddressRankList).")"; if ($this->aAddressRankList) $sSQL .= " OR placex.rank_address in (".join(',',$this->aAddressRankList).")";
$sSQL .= ") UNION select place_id from location_property_tiger where place_id in (".join(',',$aResultPlaceIDs).") "; $sSQL .= ") UNION select place_id from location_property_tiger where place_id in (".join(',',$aResultPlaceIDs).") ";
$sSQL .= "and (30 between $this->iMinAddressRank and $this->iMaxAddressRank "; $sSQL .= "and (30 between $this->iMinAddressRank and $this->iMaxAddressRank ";
if ($aAddressRankList) $sSQL .= " OR 30 in (".join(',',$aAddressRankList).")"; if ($this->aAddressRankList) $sSQL .= " OR 30 in (".join(',',$this->aAddressRankList).")";
$sSQL .= ")"; $sSQL .= ")";
if (CONST_Debug) var_dump($sSQL); if (CONST_Debug) var_dump($sSQL);
$aResultPlaceIDs = $this->oDB->getCol($sSQL); $aResultPlaceIDs = $this->oDB->getCol($sSQL);