Comments (8)
@kshvmdn some good news on the date parsing, I found out that we can do the number operations on strings in the case of dates and MongoDB will handle it for us as long as both the comparators are strings (which in this case they are). That means I retired date_num
and we don't have to deal with that mess in tests anymore too.
from cobalt.
Only got to take a brief look at this (will test in depth when I get the chance), it looks good so far.
I'm assuming date/time parsing is not complete yet (unless the plan is to ignore invalid input, in which case, this value needs to be returned).
I think mapreduce looks fine, we might be able to wrap filter comparisons into a function so we don't have to repeat code for arrays and non-arrays. Other than that, I don't think there's much else we can do.
If I think of anything, I'll let you know
from cobalt.
The goal is to house all the things we do in each filter file and abstract it. It will be similar to how an actual language interprets syntax.
from cobalt.
Happening at cobalt/filter-revamp.
from cobalt.
cobalt/filter-revamp/src/api/utils/query-parser/index.js
from cobalt.
Here's what I've got as for a preliminary filter endpoint function under the new QueryParser
model:
https://github.com/cobalt-uoft/cobalt/blob/filter-revamp/src/api/buildings/routes/filter.js
On average, filter requests in the new model fair slightly faster than the current stable release (0.4.3), tested using Nodejs 6.0 for both (~100ms difference testing 100 sequential requests, averaged over 10 attempts). Not so significant, but it's good to know its not slower.
I still haven't addressed things that require MapReduce. I'm looking into using MongoDB's new aggregate functions and whether they are speedier. Will report back as soon as I get something conclusive.
from cobalt.
QueryParser
https://github.com/cobalt-uoft/cobalt/blob/filter-revamp/src/api/utils/query-parser/index.js
courses/filter
https://github.com/cobalt-uoft/cobalt/blob/filter-revamp/src/api/courses/routes/filter.js
https://github.com/cobalt-uoft/cobalt/blob/filter-revamp/src/api/courses/routes/filterMapReduce.js
@kshvmdn this is what query parsing + a mapreduce looks like under new model. What do you think? I'm exhausted from looking at this so please help me dig around and see if we can simplify this at all ._.
from cobalt.
I've also added throwing appropriate errors, better to tell the user something went wrong I'd think.
from cobalt.
Related Issues (20)
- Transportation API HOT 4
- Athletics API HOT 4
- Date parameters in filter endpoints should support multiple formats? HOT 3
- Exams API HOT 4
- Events API HOT 1
- Building API: keys out of order HOT 5
- Time and Date updates HOT 2
- Should we discontinue /search in favour of /filter? HOT 2
- Food API: Move filter to newer ParseQuery model + abstract the `open` filter
- Campus filter not working? HOT 1
- 404 for cdf/labs and printers HOT 6
- Requires database to be called cobalt HOT 7
- DeprecationWarning: Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead HOT 1
- GET courses doesn't return any locations. HOT 2
- Problem in self-hosting HOT 6
- API server down? HOT 2
- 502 bad gateway HOT 2
- UTM courses not returning full course codes for its prerequisites
- API 502 responses HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cobalt.