foreach ($aResults as $oResult) {
if (($this->iMaxAddressRank == 30 &&
($oResult->iTable == Result::TABLE_OSMLINE
- || $oResult->iTable == Result::TABLE_AUX
|| $oResult->iTable == Result::TABLE_TIGER))
|| in_array($oResult->iId, $aFilteredIDs)
) {
$aSubSelects[] = $sSQL;
}
-
- if (CONST_Use_Aux_Location_data) {
- $sPlaceIDs = Result::joinIdsByTable($aResults, Result::TABLE_AUX);
- if ($sPlaceIDs) {
- $sHousenumbers = Result::sqlHouseNumberTable($aResults, Result::TABLE_AUX);
- $sSQL = ' SELECT ';
- $sSQL .= " 'L' AS osm_type, ";
- $sSQL .= ' place_id AS osm_id, ';
- $sSQL .= " 'place' AS class,";
- $sSQL .= " 'house' AS type, ";
- $sSQL .= ' null::smallint AS admin_level, ';
- $sSQL .= ' 30 AS rank_search,';
- $sSQL .= ' 30 AS rank_address, ';
- $sSQL .= ' place_id,';
- $sSQL .= ' parent_place_id, ';
- $sSQL .= ' housenumber,';
- $sSQL .= " 'us' AS country_code, ";
- $sSQL .= $this->langAddressSql('-1');
- $sSQL .= ' null::text AS placename, ';
- $sSQL .= ' null::text AS ref, ';
- if ($this->bExtraTags) $sSQL .= 'null::text AS extra, ';
- if ($this->bNameDetails) $sSQL .= 'null::text AS names, ';
- $sSQL .= ' ST_X(centroid) AS lon, ';
- $sSQL .= ' ST_Y(centroid) AS lat, ';
- $sSQL .= ' -1.10 AS importance, ';
- $sSQL .= $this->addressImportanceSql(
- 'centroid',
- 'location_property_aux.parent_place_id'
- );
- $sSQL .= ' null::text AS extra_place ';
- $sSQL .= ' FROM location_property_aux ';
- $sSQL .= " WHERE place_id in ($sPlaceIDs) ";
-
- $aSubSelects[] = $sSQL;
- }
- }
}
if (empty($aSubSelects)) {
const TABLE_PLACEX = 0;
const TABLE_POSTCODE = 1;
const TABLE_OSMLINE = 2;
- const TABLE_AUX = 3;
- const TABLE_TIGER = 4;
+ const TABLE_TIGER = 3;
/// Database table that contains the result.
public $iTable;
}
}
- // If nothing found try the aux fallback table
- if (CONST_Use_Aux_Location_data && empty($aResults)) {
- $sSQL = 'SELECT place_id FROM location_property_aux';
- $sSQL .= ' WHERE parent_place_id in ('.$sPlaceIDs.')';
- $sSQL .= " AND housenumber = '".$this->sHouseNumber."'";
- $sSQL .= $this->oContext->excludeSQL(' AND place_id');
-
- Debug::printSQL($sSQL);
-
- foreach ($oDB->getCol($sSQL) as $iPlaceId) {
- $aResults[$iPlaceId] = new Result($iPlaceId, Result::TABLE_AUX);
- }
- }
-
// If nothing found then search in Tiger data (location_property_tiger)
if (CONST_Use_US_Tiger_Data && $bIsIntHouseNumber && empty($aResults)) {
$sSQL = 'SELECT place_id FROM location_property_tiger';
@define('CONST_Search_BatchMode', getSettingBool('SEARCH_BATCH_MODE'));
@define('CONST_Search_NameOnlySearchFrequencyThreshold', getSetting('SEARCH_NAME_ONLY_THRESHOLD'));
@define('CONST_Term_Normalization_Rules', getSetting('TERM_NORMALIZATION'));
-@define('CONST_Use_Aux_Location_data', getSettingBool('USE_AUX_LOCATION_DATA'));
@define('CONST_Use_US_Tiger_Data', getSettingBool('USE_US_TIGER_DATA'));
@define('CONST_MapIcon_URL', getSetting('MAPICON_URL', false));
@define('CONST_Search_BatchMode', getSettingBool('SEARCH_BATCH_MODE'));
@define('CONST_Search_NameOnlySearchFrequencyThreshold', getSetting('SEARCH_NAME_ONLY_THRESHOLD'));
@define('CONST_Term_Normalization_Rules', getSetting('TERM_NORMALIZATION'));
-@define('CONST_Use_Aux_Location_data', getSettingBool('USE_AUX_LOCATION_DATA'));
@define('CONST_Use_US_Tiger_Data', getSettingBool('USE_US_TIGER_DATA'));
@define('CONST_MapIcon_URL', getSetting('MAPICON_URL', false));
$iParentPlaceID = $oDB->getOne('SELECT parent_place_id FROM location_postcode WHERE place_id = '.$iPlaceID);
if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;
-if (CONST_Use_Aux_Location_data) {
- $iParentPlaceID = $oDB->getOne('SELECT parent_place_id FROM location_property_aux WHERE place_id = '.$iPlaceID);
- if ($iParentPlaceID) $iPlaceID = $iParentPlaceID;
-}
-
$hLog = logStart($oDB, 'details', $_SERVER['QUERY_STRING'], $aLangPrefOrder);
// Get the details for this point
+++ /dev/null
-CREATE TABLE location_property_aux () INHERITS (location_property);
-CREATE INDEX idx_location_property_aux_place_id ON location_property_aux USING BTREE (place_id);
-CREATE INDEX idx_location_property_aux_parent_place_id ON location_property_aux USING BTREE (parent_place_id);
-CREATE INDEX idx_location_property_aux_housenumber_parent_place_id ON location_property_aux USING BTREE (parent_place_id, housenumber);
-GRANT SELECT ON location_property_aux TO "{www-user}";
-
END IF;
{% endif %}
- -- then additional data
- {% if config.get_bool('USE_AUX_LOCATION_DATA') %}
- IF place IS NULL THEN
- SELECT parent_place_id as place_id, 'us' as country_code,
- housenumber, postcode,
- 'place' as class, 'house' as type,
- null as name, null as address,
- centroid
- INTO place
- FROM location_property_aux
- WHERE place_id = in_place_id;
- END IF;
- {% endif %}
-
-- postcode table
IF place IS NULL THEN
SELECT parent_place_id as place_id, country_code,
+++ /dev/null
--- Functions for adding external data (currently unused).
-
-CREATE OR REPLACE FUNCTION aux_create_property(pointgeo GEOMETRY, in_housenumber TEXT,
- in_street TEXT, in_isin TEXT,
- in_postcode TEXT, in_countrycode char(2))
- RETURNS INTEGER
- AS $$
-DECLARE
-
- newpoints INTEGER;
- place_centroid GEOMETRY;
- out_partition INTEGER;
- out_parent_place_id BIGINT;
- location RECORD;
- address_street_word_ids INTEGER[];
- out_postcode TEXT;
-
-BEGIN
-
- place_centroid := ST_Centroid(pointgeo);
- out_partition := get_partition(in_countrycode);
- out_parent_place_id := null;
-
- address_street_word_ids := word_ids_from_name(in_street);
- IF address_street_word_ids IS NOT NULL THEN
- out_parent_place_id := getNearestNamedRoadPlaceId(out_partition, place_centroid,
- address_street_word_ids);
- END IF;
-
- IF out_parent_place_id IS NULL THEN
- SELECT getNearestRoadPlaceId(out_partition, place_centroid)
- INTO out_parent_place_id;
- END LOOP;
- END IF;
-
- out_postcode := in_postcode;
- IF out_postcode IS NULL THEN
- SELECT postcode from placex where place_id = out_parent_place_id INTO out_postcode;
- END IF;
- -- XXX look into postcode table
-
- newpoints := 0;
- insert into location_property_aux (place_id, partition, parent_place_id,
- housenumber, postcode, centroid)
- values (nextval('seq_place'), out_partition, out_parent_place_id,
- in_housenumber, out_postcode, place_centroid);
- newpoints := newpoints + 1;
-
- RETURN newpoints;
-END;
-$$
-LANGUAGE plpgsql;
-
CREATE INDEX idx_location_area_country_geometry ON location_area_country USING GIST (geometry) {{db.tablespace.address_index}};
-drop table IF EXISTS location_property CASCADE;
-CREATE TABLE location_property (
- place_id BIGINT,
- parent_place_id BIGINT,
- partition SMALLINT,
- housenumber TEXT,
- postcode TEXT,
- centroid GEOMETRY(Point, 4326)
- );
-
-CREATE TABLE location_property_aux () INHERITS (location_property);
-CREATE INDEX idx_location_property_aux_place_id ON location_property_aux USING BTREE (place_id);
-CREATE INDEX idx_location_property_aux_parent_place_id ON location_property_aux USING BTREE (parent_place_id);
-CREATE INDEX idx_location_property_aux_housenumber_parent_place_id ON location_property_aux USING BTREE (parent_place_id, housenumber);
-GRANT SELECT ON location_property_aux TO "{{config.DATABASE_WEBUSER}}";
-
CREATE TABLE location_property_tiger (
place_id BIGINT,
parent_place_id BIGINT,
cur.execute('TRUNCATE place_addressline')
cur.execute('TRUNCATE location_area')
cur.execute('TRUNCATE location_area_country')
- cur.execute('TRUNCATE location_property')
cur.execute('TRUNCATE location_property_tiger')
cur.execute('TRUNCATE location_property_osmline')
cur.execute('TRUNCATE location_postcode')
('Search_BatchMode', 'SEARCH_BATCH_MODE', bool),
('Search_NameOnlySearchFrequencyThreshold', 'SEARCH_NAME_ONLY_THRESHOLD', str),
('Term_Normalization_Rules', 'TERM_NORMALIZATION', str),
- ('Use_Aux_Location_data', 'USE_AUX_LOCATION_DATA', bool),
('Use_US_Tiger_Data', 'USE_US_TIGER_DATA', bool),
('MapIcon_URL', 'MAPICON_URL', str),
)
def test_truncate_database_tables(temp_db_conn, temp_db_cursor, table_factory):
tables = ('word', 'placex', 'place_addressline', 'location_area',
- 'location_area_country', 'location_property',
+ 'location_area_country',
'location_property_tiger', 'location_property_osmline',
'location_postcode', 'search_name', 'location_road_23')
for table in tables: