Closed AakashGfude closed 5 years ago
fixes #273
@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.
This branch is doing two things :-
1) Introducing a database migration flow in our application using
node-migrate
. Do read the README.md inserver/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
inserver
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}