Closed JoshuaPeddle closed 2 years ago
The responses diff is just so big because we had that extra version of validateSearchTerms hanging around.
The only thing I see is the addition to usages.js for validGeo, I suppose the $or deals with it correctly though?
Yeah it was sending the extra geos through to Usages and the validator was throwing an error. Mongo doesn't mind if we search with non-existent locations. The $or does seem to handle it correctly. If there's a combo of existing and non-existing geos mongo still returns the existing ones.
That's great, actually. Do we even benefit from the validators at this point? I saw you removed undefined keys, which I think obsoleted the validators entirely.
Hmm, they may be kind of obsolete at this point. We could still keep them I guess as they are nice for debugging, but I think the code to fetch from the DB will be okay without it.
Yeah, I'm in favour of cutting them out entirely (since that's the only place we actively use it right now), but at least removing it from every search would probably address Amilcar's complaints about efficiency.
True. If we removed that we would be quite efficient. I do think you're right about this addressing Amilcar's comments.
Our change to filters means that we get way less results when we make a search call now. From a max of like 60000+ before to a max of 134 with both Usage and Response and all location filters are selected.
Just committed a small change for map.js and frontend.js that should resolve the issues with the map.
I think we should deal with the conflict and merge this PR before things get too out of hand.
Sorry for the stupid large PR, I'm not sure why the responses.js diff is so huge. I think I have most of what we discussed worked out. When I select the filters now and do the search the correct results are displayed in the browser console for both usages and responses!
for Usage.js and Response.js I added some code to handle the arrays of geo and the age edge case with Response. The mongo queries seem to be working as intended with multiple geos.
for Usages.js and Responses.js I did some work on the validators and they seem to be working alright.
frontend.js had a bunch or small changes. my geo validator was buggy and I sorted the issue with getResponses and getUsages not returning anything.
There's a known issue with the map not painting correctly when a input box starts checked that I'll fix tomorrow.