Skip to content

Commit

Permalink
append soring by id as second criteria #EA-3419
Browse files Browse the repository at this point in the history
  • Loading branch information
GordeaS authored and GordeaS committed Aug 16, 2023
1 parent ec8b438 commit 4998f91
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import eu.europeana.set.mongo.model.internal.GeneratedUserSetIdImpl;
import eu.europeana.set.mongo.model.internal.PersistentUserSet;
import eu.europeana.set.mongo.model.PersistentUserSetImpl;
import eu.europeana.set.mongo.model.UserSetMongoConstants;
import eu.europeana.set.web.model.WebUserSetImpl;

public class PersistentUserSetDaoImpl <E extends PersistentUserSet, T extends Serializable>
Expand Down Expand Up @@ -50,7 +51,7 @@ public long generateNextUserSetId(String provider) {
synchronized (syncObj) {

Query<GeneratedUserSetIdImpl> q = getDatastore().createQuery(GeneratedUserSetIdImpl.class);
q.filter("_id", provider);
q.filter(UserSetMongoConstants.MONGO_ID, provider);

UpdateOperations<GeneratedUserSetIdImpl> uOps = getDatastore()
.createUpdateOperations(GeneratedUserSetIdImpl.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,8 @@ private void setOrder(Query<PersistentUserSet> mongoQuery, UserSetQuery query) {
// check the score sort first (it can only be in desc order)
if (sortField.contains(WebUserSetFields.TEXT_SCORE_SORT)) {
mongoQuery.order(Meta.textScore());
mongoQuery.order(Sort.ascending(UserSetMongoConstants.MONGO_ID));

} else {
if (!sortField.contains(" ")) {
mongoQuery.order(Sort.ascending(sortField));
Expand Down

0 comments on commit 4998f91

Please sign in to comment.