Skip to content

Commit

Permalink
Merge pull request #291 from NYCPlanning/289-search-by-cdta
Browse files Browse the repository at this point in the history
289 Search results now include CDTAs
  • Loading branch information
dhochbaum-dcp authored Mar 25, 2024
2 parents f5ff844 + 2975ab4 commit 34d0c47
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 4 additions & 2 deletions routes/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const neighborhoodTabulationArea = require('../search-helpers/neighborhood-tabul
const tract = require('../search-helpers/tract');
const block = require('../search-helpers/block');
const district = require('../search-helpers/district');
const cdta = require('../search-helpers/cdta');

const router = express.Router();

Expand All @@ -17,11 +18,12 @@ router.get('/', (req, res) => {
tract(q),
block(q),
district(q),
cdta(q),
])
.then((values) => {
const [addresses, ntas, tracts, blocks, districts] = values;
const [addresses, ntas, tracts, blocks, districts, cdtas] = values;
const responseArray = [];
res.json(responseArray.concat(addresses, ntas, tracts, blocks, districts));
res.json(responseArray.concat(addresses, ntas, tracts, blocks, districts, cdtas));
}).catch((reason) => {
console.error(reason); // eslint-disable-line
});
Expand Down
9 changes: 3 additions & 6 deletions search-helpers/cdta.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,12 @@ const cdta = (string) => {
WHEN borocode = '4' THEN '081'
WHEN borocode = '5' THEN '085'
END
|| countyfips as fips,
boroname || ' '
|| countyfips as fips
FROM pff_2020_cdtas_21c
) x
WHERE
cdta2020 LIKE '%25${string}%25'
OR fips LIKE '%25${string}%25'
OR boroname LIKE '%25${string}%25'
OR geolabel LIKE '%25${string}%25'
cdta2020 ILIKE '%25${string}%25'
OR geolabel ILIKE '%25${string}%25'
LIMIT 5
`;

Expand Down

0 comments on commit 34d0c47

Please sign in to comment.