QuantEcon / Bookshelf

Code for the site QuantEconLib
1 stars 0 forks source link

FEAT: Top page search enhancements #319

Closed AakashGfude closed 5 years ago

AakashGfude commented 5 years ago

This branch is doing two things :-

1) Introducing a database migration flow in our application using node-migrate. Do read the README.md in server/js/db folder. node-migrate seems like a good framework with active contributors and good amount of stars.

2) editing the submissions collection to add authorName so that it can be indexed for search which solves this issue .

Searching by notebook content is not yet implemented, as it requires some tricky changes. As mentioned in this issue link, at present we will have to index the whole notebook json which is not efficient. We can use this branch to write code to make changes and achieve this.

Anyone using this branch will have to first run migration after installing the dependencies from package.json in server folder, and following this README. After that, will have to drop the indexes for submission collection and then start the app, it will reindex. Commands for dropping index :- 1) mongo 2) use Bookshelf 3) db.submissions.dropIndexes()

Apologies for this, but automatically deleting indexes and recreating them was not working and seemed risky.

At present, the weight of indexed fields for searching is {title: 2, authorName: 2, summary: 1}

AakashGfude commented 5 years ago

fixes #273

AakashGfude commented 5 years ago

@AtlasMaxima we don't have to do it every time. It is only a one-time thing. At present, you are facing this problem because indexes are different in different branches. So whenever you change branch it causes a problem. Once we merge it with master and update our branches with the master branch, it won't be a problem. Writing a script is risky and unnecessary as it is a one-off thing. There are no risks of dropping the indexes in our project as of now, as it automatically gets rebuilt once we start the server.