Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

289 Search results now include CDTAs #291

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still have access to the fips and boroname information in the feature.properties on line 33?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we are still returning those fields (lines 11 and 21); we are just not searching within them for the queried string.

LIMIT 5
`;

Expand Down
Loading