Skip to content

Commit a5133bd

Browse files
author
thisismeonmounteverest
committed
Adapt manticore:indices:geonames to new database schema.
1 parent 54a36a4 commit a5133bd

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Command/ManticoreIndicesGeonamesCommand.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ private function addGeonamesDocuments(Table $index, OutputInterface $output): vo
128128
do {
129129
$query = $this->entityManager->createNativeQuery(<<<___SQL
130130
SELECT
131-
g.geonameid AS geonameid,
131+
g.geoname_id,
132132
g.`name` AS name,
133133
g.feature_class,
134134
g.feature_code,
@@ -153,7 +153,7 @@ private function addGeonamesDocuments(Table $index, OutputInterface $output): vo
153153
GROUP BY
154154
a.location
155155
) membercounts
156-
ON (g.geonameid = membercounts.location)
156+
ON (g.geoname_id = membercounts.location)
157157
LIMIT {$firstResult}, {$this->chunkSize}
158158
___SQL, $this->getResultSetMappingForGeonamesIndex());
159159

@@ -190,7 +190,7 @@ private function addAlternateNamesDocuments(Table $index, OutputInterface $outpu
190190
do {
191191
$query = $this->entityManager->createNativeQuery(<<<___SQL
192192
SELECT
193-
g.geonameid,
193+
g.geoname_id,
194194
gt.`content` AS name,
195195
g.feature_class,
196196
g.feature_code,
@@ -205,19 +205,19 @@ private function addAlternateNamesDocuments(Table $index, OutputInterface $outpu
205205
FROM
206206
geo__names g
207207
JOIN
208-
geo__names_translations gt ON g.geonameId = gt.foreign_key
208+
geo__names_translations gt ON g.geoname_id = gt.object_id
209209
LEFT JOIN (
210210
SELECT
211211
a.location,
212212
COUNT(a.location) total
213213
FROM
214-
members m,
214+
member m,
215215
address a
216216
WHERE m.status IN ('Active', 'OutOfRemind') and m.id = a.member_id
217217
GROUP BY
218218
a.location
219219
) membercounts
220-
ON (g.geonameid = membercounts.location)
220+
ON (g.geoname_id = membercounts.location)
221221
LIMIT {$firstResult}, {$this->chunkSize}
222222
___SQL, $this->getResultSetMappingForGeonamesIndex());
223223

@@ -253,7 +253,7 @@ private function addGeonamesDocumentsToIndex(Table $index, NativeQuery $query, P
253253
$isAdmin = 'A' === $location['feature_class'] && !$isCountry;
254254

255255
$documents[] = [
256-
'geoname_id' => $location['geonameid'],
256+
'geoname_id' => $location['geoname_id'],
257257
'name' => $location['name'],
258258
'country' => $location['country'] ?? 0,
259259
'isPlace' => $isPlace,
@@ -286,7 +286,7 @@ private function getResultSetMappingForGeonamesIndex(): ResultSetMapping
286286
{
287287
$rsm = new ResultSetMapping();
288288
$rsm
289-
->addScalarResult('geonameid', 'geonameid')
289+
->addScalarResult('geoname_id', 'geoname_id')
290290
->addScalarResult('name', 'name')
291291
->addScalarResult('country_id', 'country')
292292
->addScalarResult('admin_1_id', 'admin1')

0 commit comments

Comments
 (0)