Implementing Sort By Date Feature In Susper
Susper has been given ‘Sort By Date’ feature which provides the user with latest results with the latest date. This feature enhances the search experience and helps users to find desired results more accurately. The sorting of results date wise is done by yacy backend which uses Apache Solr technology.
The idea was to create a ‘Sort By Date’ feature similar to the market leader. For example, if a user searches for keyword ‘Jaipur’ then results appear to be like this:
If a user wishes to get latest results, they can use ‘Sort By Date’ feature provided under ‘Tools’.
The above screenshot shows the sorted results.
You may however notice that results are not arranged year wise. Currently, the backend work for this is being going on Yacy and soon will be implemented on the frontend as well once backend provide us this feature.
Under ‘Tools’ we created an option for ‘Sort By Date’ simply using <li> tag.
<li (click)=”filterByDate()”>Sort By Date</li>
</ul>
When clicked, it calls filterByDate() function to perform the following task:
let urldata = Object.assign({}, this.searchdata);
urldata.query = urldata.query.replace(“/date”, “”);
this.store.dispatch(new queryactions.QueryServerAction(urldata));
}
The source code for the implementation can be found here: https://github.com/fossasia/susper.com/blob/master/src/app/results/results.component.ts
Resources:
- YaCy WebClient Bootstrap: https://github.com/yacy/yacy_webclient_bootstrap
- Solr Query Parameters documentation: https://cwiki.apache.org/confluence/display/solr/Common+Query+Parameters
You must be logged in to post a comment.