Info |
---|
Valid from up to Datafari X4.X3 |
Problematic :
Users have the possibility to store pointers to documents shown in results list.
...
Expand | ||
---|---|---|
| ||
Problematic : Starting with Datafari 2.0, users have the possibility to store pointers to documents shown in results list. In the following document, “likes” corresponds to the functionality where a connected user can like or unlike a document, and “favorites” corresponds to the functionality where a connected user can save a pointer to a document he found in the results list. Technically wise, we use Apache Cassandra for saving all the likes and favorites and Solr for saving the counters of likes of each document. Using Cassandra, we cannot use standard relational db schemas, like the following: Modeling with Nosql in mind: For our nosql modeling, we took our inspiration from this article http://docs.mongodb.org/manual/tutorial/aggregation-with-user-preference-data/ . Applied to our problematic, we get the following : That means we have dedicated to likes and favorites (which is distinct from the collection dedicated to user authentication and authorization). The request : The aim is to get for the connected user the list of documents he liked out of the ones which are currently displayed. After the standard search query, we send only one http request which contains only the username . In return, we get all the documents in the index that are liked, as well as the list of favorites. On the browser side, we go through this documents list and pick the ones that match the currently displayed documents to identify the favorites and the liked. In order to display the total number of likes per documents, we use Solr and its External File Fields mechanism ( https://cwiki.apache.org/confluence/display/solr/Working+with+External+Files+and+Processes). Every time a connected user like or unlikes a document, we increment or decrement the counter of the document in the file located in The Implementation : There are two parts: Frontend and backend. For the frontend, we added a widget that builds the inteface and makes all the Ajax Requests. For the backend, we created two classes: Like and Favorite. We created the corresponding servlets that use these two classes and send back the result.
Illustration 1: State Diagram of AfterRequest of LikesAndFavoritesWidget 2. Backend : We use two major classes which are
We also use the following servlets:
Illustration 2: Sequence Diagram of AddLike for a normal Behaviour Here is the sequence diagram that involves the Illustration 3: Sequence Diagram of getting the likes and favorites from server |