Thursday, August 8, 2013

NUS ModCrasher: Behind the Scene #1 - GQL Restriction



While we were doing the search system, we ran into a trouble: GQL query restriction. It only allows one inequality to be in the query, while we need two to find lectures between the start time and the end time. So, how should I approach this, since I was the one in-charge of the search system?

Initially, I thought of appending the search result one by one, meaning since lectures start time is on half-hourly period, I could just make a loop between start time and end time, essentially no inequality in the query at all. But then, I did not know how to append the queries, and time was not on our side. I decided to find something else.

I was thinking that Jinja2 template that we are using supports python one way or another. Could I utilize that? Probably! So I tried it; our GQL query run with one inequality and our Jinja2 template would do the other by using "for if" statement. It works! I am not sure about the performance of such solution, but it works for the time being and we are keeping it for now.

No comments:

Post a Comment